Reputation: 171
I have added the api keys in the manifest, enabled the Android Map sdk in the console, the app is displaying on my IOS stimulator but It is blank on both my android emulator and android phone.
GoogleMap(
mapType: MapType.hybrid,
initialCameraPosition: CameraPosition(
target: LatLng(
mydetails.lat!.toDouble(),
mydetails.lng!.toDouble(),
),
zoom: 14),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
// markers: {
// belgaum,
// },
);
Upvotes: 0
Views: 463
Reputation: 31
First add package "Flutter google maps" from pub.dev then paste the below code
GoogleMap(
myLocationEnabled: false,
myLocationButtonEnabled: false,
zoomControlsEnabled: false,
mapType: MapType.normal,
initialCameraPosition: CameraPosition(
target: _latLng,
zoom: 16.0,
),
onMapCreated: (controller) {
mapController = controller;
setState(() {});
},
compassEnabled: false,
onCameraIdle: () {},
onCameraMove: (position) {},
),
Add google map api in Android menifiest file in Application section.
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="Your_api_key"/>
Change your min sdkversion to 23 in app/build.gradle file
Upvotes: 2