eventAction method
dynamic
eventAction(
- bool isForStorage,
- bool isFromPicker,
- PermissionType permissionType,
- int index,
- Map<
Permission, PermissionStatus> status,
On click of allow or denied event this method will be called...
Implementation
eventAction(
bool isForStorage,
bool isFromPicker,
PermissionType permissionType,
int index,
Map<Permission, PermissionStatus> status) async {
/// current device android sdk version is greater than 33 than we need to request Permission.photos
if (Platform.isAndroid) {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
if (status[isForStorage
? (androidInfo.version.sdkInt >= 33)
? Permission.photos
: Permission.storage
: Permission.camera] ==
PermissionStatus.granted) {
add(AllowPermissionEvent(isFromPicker, permissionType, index));
} else {
add(DenyPermissionEvent(isFromPicker, permissionType, index));
}
} else {
if (status[isForStorage ? Permission.photos : Permission.camera] ==
PermissionStatus.granted) {
add(AllowPermissionEvent(isFromPicker, permissionType, index));
} else {
add(DenyPermissionEvent(isFromPicker, permissionType, index));
}
}
}