requestPermissions method

Future<Map<Permission, PermissionStatus>> requestPermissions(
  1. List<Permission> permissions
)

Requests the user for access to the supplied list of Permissions, if they have not already been granted before.

Returns a Map containing the status per requested Permission.

Implementation

Future<Map<Permission, PermissionStatus>> requestPermissions(
    List<Permission> permissions) async {
  final Map<Permission, PermissionStatus> permissionStatusMap = {};

  for (final permission in permissions) {
    try {
      permissionStatusMap[permission] =
          await _requestSingularPermission(permission);
    } on UnimplementedError {
      rethrow;
    }
  }
  return permissionStatusMap;
}