Issue
I’m trying to use google_maps_flutter package but TargetPlatform.fuchsia is not yet supported by the maps plugin is displayed instead of the map, I’m not receiving any error in the console. I have added the meta-data entry containing the API key to AndroidManifest.xml
file in android/app/src/main
.
received message instead of the map
below is my code.
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
GoogleMapController mapController;
final LatLng _center = const LatLng(45.521563, -122.677433);
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Maps Sample App'),
backgroundColor: Colors.green[700],
),
body: GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
),
),
);
}
}
how can I fix this?
Solution
The problem was a line of code in main.dart
:
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
I commented it out and the problem fixed.
Answered By – AliGanjei
Answer Checked By – Marie Seifert (FlutterFixes Admin)