Up to permission_handler 5.0.0+hotfix.2. Problem is still here.
Flutter 1.12.13+hotfix.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 0b8abb4724 (7 weeks ago) • 2020-02-11 11:44:36 -0800
Engine • revision e1e6ced81d
Tools • Dart 2.7.0
I have a simple app, where i ask permission storage.
Future<void> _attachFile() async {
requestPermission(Permission.storage);
bool storage = await isPermissionGranted(Permission.storage);
if (!storage) {
_showInSnackBar(Localization.of(context).translate('access_file'));
return;
}
_attachedFile = await FilePicker.getFilePath(type: FileType.any);
setState(() {});
}
Future<bool> isPermissionGranted(Permission permission) async {
return await permission.isGranted;
}
Future<void> requestPermission(Permission permission) async {
await permission.request();
}
1 - Ask a permission, and say "no" (run Future
2- When ask again (run Future
E/flutter (11118): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(PermissionHandler.PermissionManager, A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time)., null) - in log
And nothing happens in mobile
What i'am doing wrong?
Or in new version need work only with status? Like this:
var status = await Permission.camera.status;
if (status.isUndetermined) {
// We didn't ask for permission yet.
}
You can can also directly ask the permission about its status.
if (await Permission.location.isRestricted) {
The OS restricts access, for example because of parental controls.
}
PS Sorry for my English :-)
I'm also having this same problem. Is there a certain way to determine if a permission request is already running?
If there is no such feature and it makes sense to you, I can try to add it.
I expect the following:
Access request
If the user replied "Deny" - the end of this request
Message output - access is needed for ...
A new access request, if the user decides to give permission - now this is possible only if you restart the application
How do I implement this?
PS Sorry for my English :-)
Most helpful comment