requestStoragePermission function
Future<void>
requestStoragePermission({
- required dynamic callback(),
- required dynamic callbackErr(),
Implementation
Future<void> requestStoragePermission({
required Function() callback,
required Function(PermissionException) callbackErr,
}) async {
if (Platform.isAndroid) {
var permissionStatus =
await AndroidPlatform.requestPermission(Permission.storage);
if (permissionStatus) {
callback();
} else {
var status = await AndroidPlatform.checkPermission(Permission.storage);
if (status == PermissionStatus.denied) {
callbackErr(PermissionException('Storage permission denied'));
} else {
callback();
}
}
} else {
callback();
}
}