requestPermission method

Future<LocationPermission> requestPermission([
  1. BackgroundPermissionRationale? rationale
])

Request permission to access the location of the device.

Returns a Future<LocationPermission> which when completes indicates if the user granted permission to access the device's location in this request.

If rationale is not null, it will be shown a default rationale dialog when request background permission denied and shouldShowRequestPermissionRationale return true.(Only for Android 11 or higher)

Throws a PermissionDefinitionsNotFoundException when the required platform specific configuration is missing (e.g. in the AndroidManifest.xml on Android or the Info.plist on iOS).

A PermissionRequestInProgressException is thrown if permissions are requested while an earlier request has not yet been completed.

⚠️ Note: The return value is the same as checkPermission return value in most of the time. but there is some exceptions. requestPermission return value is indicates this time request get what kind permission. checkPermission is the permission already have. for example: Now already has 'whileInUse' permission, call requestPermission to upgrade to 'always' permission, but user do not approve upgrade to 'always', then requestPermission while return 'denied' or 'deniedForever' indicates this request failed.

Implementation

Future<LocationPermission> requestPermission(
    [BackgroundPermissionRationale? rationale]) {
  throw UnimplementedError('requestPermission() has not been implemented.');
}