permissionCheck method

Future<PermissionState> permissionCheck()

Request the current PermissionState of required permissions. 请求所需权限的 PermissionState

Throws a StateError when the state is not PermissionState.authorized or PermissionState.limited, which means the picker can not perform further actions. 当权限状态不是 PermissionState.authorizedPermissionState.limited 时, 将抛出 StateError,此时选择器无法执行其他操作。

See also:

Implementation

Future<PermissionState> permissionCheck() async {
  final PermissionState ps = await PhotoManager.requestPermissionExtend();
  if (ps != PermissionState.authorized && ps != PermissionState.limited) {
    throw StateError('Permission state error with $ps.');
  }
  return ps;
}