requestPermission static method

dynamic requestPermission(
  1. List<Permission> permissionList
)

获取新列表中的权限 如果有一项不合格就返回false

Implementation

static 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;
}