isGranted method

Future<bool> isGranted()

Implementation

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