I am trying to Implement google map in the flutter application by using google_maps_flutter this package.
But map is not coming in the UI.
I have attached the code below
GoogleMap(
mapType: MapType.hybrid,
onTap: (LatLng point) {
print("object");
// controller.addPoint(point);
},
onMapCreated: (GoogleMapController controller1) {
print("0########################");
controller.mapController = controller1;
},
initialCameraPosition: CameraPosition(
target: LatLng(9.9252, 78.1198),
zoom: 10,
),
),
This is log I am getting. In this there are
GOING TO ROUTE /map
[GETX] Instance "MapController" has been created
[GETX] Instance "MapController" has been initialized
I/PlatformViewsController(18119): Hosting view in view hierarchy for
platform view: 11
I/PlatformViewsController(18119): PlatformView is using
SurfaceProducer backend
D/EGL_emulation(18119): app_time_stats: avg=5517.29ms min=5517.29ms
max=5517.29ms count=1
D/EGL_emulation(18119): app_time_stats: avg=1597.63ms min=264.54ms
max=5514.03ms count=4
[GETX] CLOSE TO ROUTE /map
D/EGL_emulation(18119): app_time_stats: avg=946.37ms min=60.32ms
max=3086.62ms count=4
V/GoogleMapController(18119): Controller was disposed before
GoogleMap was ready.
V/GoogleMapController(18119): Controller was disposed before
GoogleMap was ready.
V/GoogleMapController(18119): Controller was disposed before
GoogleMap was ready.
V/GoogleMapController(18119): Controller was disposed before
GoogleMap was ready.
E/PlatformViewsController(18119): Disposing platform view threw an
exception
E/PlatformViewsController(18119): java.lang.NullPointerException:
Attempt to invoke virtual method 'boolean
java.util.LinkedList.isEmpty()' on a null object reference
E/PlatformViewsController(18119): at
com.google.android.gms.dynamic.DeferredLifecycleHelper.zae(com.google.android.gms:play-services-base@@18.3.0:1)
E/PlatformViewsController(18119): at com.google.android.gms.dynamic.DeferredLifecycleHelper.onDestroy(com.google.android.gms:play-services-base@@18.3.0:2)
E/PlatformViewsController(18119): at com.google.android.gms.maps.MapView.onDestroy(com.google.android.gms:play-services-maps@@18.2.0:1)
E/PlatformViewsController(18119): at io.flutter.plugins.googlemaps.GoogleMapController.destroyMapViewIfNecessary(GoogleMapController.java:766)
E/PlatformViewsController(18119): at io.flutter.plugins.googlemaps.GoogleMapController.dispose(GoogleMapController.java:384)
E/PlatformViewsController(18119): at io.flutter.plugin.platform.PlatformViewsController$1.dispose(PlatformViewsController.java:254)
E/PlatformViewsController(18119): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.dispose(PlatformViewsChannel.java:150)
E/PlatformViewsController(18119): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:58)
E/PlatformViewsController(18119): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/PlatformViewsController(18119): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/PlatformViewsController(18119): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/PlatformViewsController(18119): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
E/PlatformViewsController(18119): at android.os.Handler.handleCallback(Handler.java:959)
E/PlatformViewsController(18119): at android.os.Handler.dispatchMessage(Handler.java:100)
E/PlatformViewsController(18119): at android.os.Looper.loopOnce(Looper.java:232)
E/PlatformViewsController(18119): at android.os.Looper.loop(Looper.java:317)
E/PlatformViewsController(18119): at android.app.ActivityThread.main(ActivityThread.java:8705)
E/PlatformViewsController(18119): at java.lang.reflect.Method.invoke(Native Method)
E/PlatformViewsController(18119): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
E/PlatformViewsController(18119): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
[GETX] "MapController" onDelete() called
[GETX] "MapController" deleted from memory
[GETX] Instance "MapController" already removed.
D/EGL_emulation(18119): app_time_stats: avg=2195.50ms min=372.13ms max=4018.86ms count=2
This is displaying. Only blank screen is coming in the page.
API_KEY
for google maps?