requestPermission static method

Future<PermissionStatus> requestPermission(
  1. List<Permission> permissionList
)

请求权限

Implementation

static Future<PermissionStatus> requestPermission(List<Permission> permissionList) async {
  Map<Permission, PermissionStatus> statuses = await permissionList.request();
  PermissionStatus currentPermissionStatus = PermissionStatus.granted;
  statuses.forEach((key, value) {
    if (!value.isGranted) {
      currentPermissionStatus = value;
      return;
    }
  });
  return currentPermissionStatus;
}