When the map is built for the first time
GoogleMap(
initialCameraPosition: _startPosition,
myLocationEnabled: true,
);
the system asks for permission
How can I catch the moment when the user has made a choice?
When the map is built for the first time
GoogleMap(
initialCameraPosition: _startPosition,
myLocationEnabled: true,
);
the system asks for permission
How can I catch the moment when the user has made a choice?
You can use hasPermission
method of location class using location plugin. From this you can catch the moment.
please look at below :-
final _hasLocationPermission = await location.hasPermission();
if (_hasLocationPermission == PermissionStatus.granted) {
//Code here
} else if (_hasLocationPermission == PermissionStatus.denied) {
final _permissionGranted = await location.requestPermission();
if (_permissionGranted == PermissionStatus.granted) {
//Code here
} else if (_permissionGranted == PermissionStatus.denied) {
//Code here
}
}