request method

Requests permission for the given type.

If permission is already granted or limited, silently returns the corresponding PermissionStatus without showing a dialog. Otherwise, shows the system permission dialog.

Throws PlatformException with code "CONCURRENT_REQUEST" if another permission request is already in progress.

Implementation

Future<PermissionStatus> request(PermissionType type) async =>
    JsonHelpers.decodeEnum(
      await _channel.invokeMethod<String>('permissions.request', {
        'type': type.name,
      }),
      PermissionStatus.values,
      PermissionStatus.denied,
    );