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
trueif storage permission is granted, orfalseif 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
}
Android Manifest
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
This method should be implemented to check and request storage permissions.
Implementation
@override
Future<bool> isStoragePermissionGranted() async {
return true;
}