Flutter - Google Maps doesn´t wait to Location

后端 未结 3 1988
不思量自难忘°
不思量自难忘° 2021-01-20 16:16

I´m trying to show a map with current location. For do this i used Location and Google Map plugins (last version).

I have a code similar to:

var lng,         


        
3条回答
  •  不思量自难忘°
    2021-01-20 16:20

    Show an empty Container() or any loading indicator while your lat and lng is null.

    lat == null || lng == null
      ? Container()
      : GoogleMap(
          mapType: MapType.hybrid,
          myLocationButtonEnabled: true,
          myLocationEnabled: true,
          initialCameraPosition: CameraPosition(
            target: LatLng(lat, lng),
            zoom: 15.0,
          ),
        );
    

提交回复
热议问题