Flutter - Google Maps doesn´t wait to Location

后端 未结 3 1989
不思量自难忘°
不思量自难忘° 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:32

    You can also try this, and get rid of the empty Container.

    GoogleMap(
          mapType: MapType.hybrid,
          myLocationButtonEnabled: true,
          myLocationEnabled: true,
          initialCameraPosition: CameraPosition(
            target: LatLng(lat ?? 0, lng ?? 0), // so if lat, lng is null, we use 0 as placeholder. 
            zoom: 15.0,
          ),
        )
    

提交回复
热议问题