promptPermissionSetting static method

Future<bool> promptPermissionSetting()

Implementation

static Future<bool> promptPermissionSetting() async {
  if (Platform.isAndroid) {
    final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
    final AndroidDeviceInfo info = await deviceInfoPlugin.androidInfo;
    if (info.version.sdkInt >= 33) {
      if (await PhoneGalleryController.requestPermission(Permission.photos)) {
        return await PhoneGalleryController.requestPermission(
            Permission.videos);
      } else {
        return false;
      }
    } else {
      return await PhoneGalleryController.requestPermission(
          Permission.storage);
    }
  }
  bool statusStorage =
      await PhoneGalleryController.requestPermission(Permission.storage);
  if (statusStorage) {
    return await PhoneGalleryController.requestPermission(Permission.photos);
  }
  return false;
}