0

When the map is built for the first time

GoogleMap(
  initialCameraPosition: _startPosition,
  myLocationEnabled: true,
);

the system asks for permission

1

How can I catch the moment when the user has made a choice?

Alex
  • 1,457
  • 1
  • 13
  • 26

1 Answers1

0

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
        }
      }
Jaimil Patel
  • 1,301
  • 6
  • 13
  • But you have given only the function for handling the result. A result handling is not a problem. I need to find an event into which I can insert this handling. – Alex Dec 28 '20 at 11:16