Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps shows blank map using google_maps_flutter plugin

Tags:

flutter

dart

I'm working on an app that uses the google_maps_flutter plugin (version 0.5.7) to display a map. It was working just perfectly until yesterday. I didn't do any updates to my app, it just stopped displaying a blank map when I opened it today. Flutter Doctor doesn't show any problem, and the same with Flutter Analyze. The plugin seems to be partially working, because I'm using the GoogleMap onTap property to show the coordinates of the location tapped, and it works just fine (I/flutter (11935): LatLng(25.895589930847475, -80.28307791799307), although the marker is not created.

_handleTap(LatLng point) {
  setState(() {
     print(point);
    _markers.add(Marker(
        markerId: MarkerId(point.toString()),
        position: point,
        infoWindow: InfoWindow(
        title: point.toString(),
        ),
    icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueMagenta),
   ));
  });
}

Any ideas, what could be happening? Has any issue been reported for this plugin that could cause this issue?

enter image description here

like image 826
cubanGuy Avatar asked Jul 26 '26 14:07

cubanGuy


1 Answers

  1. Log in to the [Google Cloud Platform Console][1].
  2. Click the project drop-down and select or create the project for which you want to add an API key.
  3. Click the menu (top-left hamburger) button and select APIs & Services > Credentials.
  4. On the Credentials page, click Create credentials > API key. Repeat this step to create 2 keys.
  5. In your Flutter project, ensure the following files use an active API key:
    • android/app/src/main/AndroidManifest.xml
    • ios/Runner/AppDelegate.swift
  6. Click the menu (top-left hamburger) button and select APIs & Services > Library
  7. Click on each of the following items and then click 'Enable'
    • Maps SDK for Android
    • Maps SDK for iOS
  8. I would suggest going back to the API keys you created in step 3 and then restricting one to iOS apps and the Maps SDK for iOS and the other to Android and the Maps SDK for Android.

    [1]: https://cloud.google.com/console/google/maps-apis/overview

like image 63
Mike Dubs Avatar answered Jul 29 '26 07:07

Mike Dubs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!