I\'m having some problems getting permissions to the external storage on android devices with flutter.
When I try to create a directory in my external storage I get
Beside needing to add WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE to your android/app/src/main/AndroidManifest.xml
...
You also need Runtime Request Permission, by using simple_permissions package:
import 'package:simple_permissions/simple_permissions.dart';
PermissionStatus permissionResult = await SimplePermissions.requestPermission(Permission. WriteExternalStorage);
if (permissionResult == PermissionStatus.authorized){
// code of read or write file in external storage (SD card)
}
Note:
SimplePermissions.requestPermission for the First Time, app will popup a window, you MUST click ALLOW:
to give permission.
DENY, then uninstall debug app and re-debug it to install and fix this -> trigger the popup window and give you chance to click ALLOW.