getPermissionState static method

Future<PermissionState> getPermissionState({
  1. required PermissionRequestOption requestOption,
})

Get the current PermissionState of the photo library with the given requestOption.

Example:

final PermissionState state = await PhotoManager.getPermissionState(
  requestOption: const PermissionRequestOption(
    androidPermission: AndroidPermission(
  ),
);
if (state == PermissionState.authorized) {
  print('The application has full access permission');
} else {
  print('The application does not have full access permission');
}

Note: On Android, this method may require an Activity context. Call setIgnorePermissionCheck if the call is from background service.

Implementation

//        type: RequestType.image,
//        mediaLocation: false,
//      ),
///   ),
/// );
/// if (state == PermissionState.authorized) {
///   print('The application has full access permission');
/// } else {
///   print('The application does not have full access permission');
/// }
/// ```
///
/// Note: On Android, this method may require an `Activity` context.
/// Call [setIgnorePermissionCheck] if the call is from background service.
static Future<PermissionState> getPermissionState({
  required PermissionRequestOption requestOption,
}) {
  return plugin.getPermissionState(requestOption);
}