Home > Software engineering >  flutter: google maps are not displayed
flutter: google maps are not displayed

Time:03-04

I don't understand why google maps are not displayed. I took the code from the sample package on pub dev and the debug console does not output anything. I use the package only for iOS

class _MainScreenState extends State<MainScreen> {
  Completer<GoogleMapController> _controller = Completer();
  GoogleMapController? newGoogleMapController;

  static final CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  static final CameraPosition _kLake = CameraPosition(
      bearing: 192.8334901395799,
      target: LatLng(37.43296265331129, -122.08832357078792),
      tilt: 59.440717697143555,
      zoom: 19.151926040649414);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          GoogleMap(
            mapType: MapType.normal,
            myLocationButtonEnabled: true,
            initialCameraPosition: _kGooglePlex,
            onMapCreated: (GoogleMapController contoller) {
              _controller.complete(contoller);
              newGoogleMapController = contoller;
            },
          ),
        ],
      ),
    );
  }
}

enter image description here

CodePudding user response:

i had the same problem before a thou days and in my case the solution was:

  1. go to this link: enter image description here

  2. then look if you have enabled the Maps SDK for Android and IOS enter image description here

hope it helps!

CodePudding user response:

I don't know what the problem was, but I just changed the iPhone simulator and everything worked

  • Related