The package has been designed so you don't need to handle permissions manually. The first call to getLocation or onLocationChanged will automatically request the permissions.

If you need to handle the permissions manually you can still use the requestPermissions method.

Get Permission Status#

Future<PermissionStatus> getPermissionStatus()

If the status is PermissionStatus.authorizedAlways or PermissionStatus.authorizedWhenInUse you can use the getLocation method.

If the status is PermissionStatus.notDetermined you can use the requestPermissions method to get the permission.

If the status is PermissionStatus.denied your user will not be shown the permission popup the next time. The next location request will probably fail. You should request the user to manually change the settings of the app.

Request Permissions#

Future<PermissionStatus> requestPermission()

A dialog will be shown to the user if the location has not been granted yet. If a reduced precision permission has been given, the user will be asked to grant the precise permission.


Getting permission status#

final permission = await getPermissionStatus();
if (permission == PermissionStatus.denied) {
    print("The user will not allow you to use the location");