fxCanAccessGallery function
Implementation
Future<bool> fxCanAccessGallery() async {
bool useStoragePermission = false;
if (Platform.isAndroid) {
final androidInfo = await DeviceInfoPlugin().androidInfo;
final androidVersion = androidInfo.version.sdkInt;
if (androidVersion <= 32) {
useStoragePermission = true;
await Permission.storage.request();
}
}
await Permission.photos.request();
PermissionStatus galleryPermission;
if (useStoragePermission) {
galleryPermission = await Permission.storage.status;
} else {
galleryPermission = await Permission.photos.status;
}
if (galleryPermission == PermissionStatus.granted) {
return true;
}
return false;
}