I am using the permission_handler which is working fine, but now I need to know if a certain Permission
has been requested
before.
So I am looking for something like PermissionStatus.notDetermined
. Does this package offer something like this? I couldn’t find it, but it is at least for me quite an important thing to know.
I know there is something similar in the firebase_messaging
package.
I only want to display a pop up, if the the systemPermissionStatus has NOT been requested before.
This can of course also be done with saving some values like "wasRequested" in SharedPreferences
for example, but I thought there must be an existing function for this usecase?
Let me know if you need any more information.
Update
I also noticed that status
and the returned status
from .request
is different.
That doesn’t make any sense for me, it’s super confusing.
final stat = await Permission.notification.status; // -> denied
final req = await Permission.notification.request(); // -> permanentlyDenied
2
Answers
as @gopelkujo already pointed out:
The wording "denied" is a bit confusing I think..
To my issue: It was always giving me back
denied
instead ofpermanentlyDenied
, because I didn't do the configuration correctly. After adding the setup in thePodfile
, everything is working as expected.You can see the first example in the How to use section of documentation is using
Permission.camera.status.isDenied
to determine if the permissions is denied or not asked yet. It’s said in the code comment:I provide example code that using
isDenied
for conditioning the popup