isStoragePermissionGranted method
Checks if the storage permission is granted.
This function checks the current storage permission status. If the permission
is granted, it returns true
. If the permission is not granted, it requests
the permission and returns true
if granted, or false
if the permission is denied.
Tested Devices
android version 5 -> 15 tested
Returns:
- A Future<bool> that completes with
true
if storage permission is granted, orfalse
if the permission is denied or not granted after a request.
Example Usage:
bool isGranted = await isStoragePermissionGranted();
if (isGranted) {
// Permission granted, proceed with accessing storage
} else {
// Permission denied, show an error or request again
}
This method should be implemented to check and request storage permissions.
Implementation
@override
Future<bool> isStoragePermissionGranted() async {
return await ThanPkg.android.permission.isStoragePermissionGranted();
}