showMyLocation property
showMyLocation
determines whether or not the current device location
should be displayed on the map. It will default to false if not specified.
Enabling this feature requires adding location permissions to both native platforms of your app.
-
On Android add either
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
or<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
to yourAndroidManifest.xml
file.ACCESS_COARSE_LOCATION
returns a location with an accuracy approximately equivalent to a city block, whileACCESS_FINE_LOCATION
returns as precise a location as possible, although it consumes more battery power. You will also need to request these permissions during run-time. If they are not granted, feature will fail silently. -
On iOS add a
NSLocationWhenInUseUsageDescription
key to yourInfo.plist
file. This will automatically prompt the user for permissions when the map is loaded.
Implementation
final bool? showMyLocation;