Error:
PlatformException(read_external_storage_denied, User did not allow reading external storage, null, null)
Sulotion:
The application is attempting to access external storage, but the required permission has not been granted by the user, as indicated by the error message “PlatformException(read_external_storage_denied, User did not allow reading external storage, null, null)”.
The following actions will fix this problem:
- Request Permission:
Before trying to access external storage, be sure you are asking the READ_EXTERNAL_STORAGE permission. To request permissions, use the permission_handler package. Here’s how to accomplish it:
Also, ensure that these declarations are within the <manifest>
tag.
- Check Flutter Version:
Ensure that the file_picker package and the Flutter framework are up to date. Older versions may not work with newer ones.
Your pubspec.yaml file has to have the file_picker dependency updated.
dependencies:
file_picker: ^4.2.0 # or the latest version
Run flutter pub get
to fetch the new dependenc
- Test on Real Device:
On emulators, permission-related problems can occasionally act differently. To achieve a more accurate depiction of user interactions, test your app on a real device.
- Reinstall the App:
Take into consideration removing and reinstalling the programme from the device if you made modifications to its dependencies or permissions.