flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

When request a group permission. The last permission status always be a Undetermined.

Open zlssy opened this issue 5 years ago • 1 comments

🐛 Bug Report

Expected behavior

Reproduction steps

Configuration

Version: 1.x

Platform:

  • [ ] :iphone: iOS
  • [ ] :robot: Android

My Code: Future<List> getPermissionGroup(List<Permission> pl) async { Map<Permission, PermissionStatus> status = await pl.request(); List ret = []; status.forEach((key, value) async { print('$key : ${status[key]}'); ret.add(value.isGranted); }); print(ret); return ret; }

The last permission status always show me a undeterminded when i debug it.

zlssy avatar Jul 30 '20 03:07 zlssy

Hi @zlssy, is it always the same permission you ask as last?

I tried to reproduce it with your code snipper slightly changed, my code looks like this:

Map<Permission, PermissionStatus> statuses = await [Permission.camera, Permission.calendar, Permission.location].request();
    List ret = [];
    statuses.forEach((key, value) async {
      print('$key : ${statuses[key]}');
      ret.add(value.isGranted);
    });
    print(ret); 

The outcome of the prints however is like this:

 I/flutter (10412): Permission.calendar : PermissionStatus.granted
I/flutter (10412): Permission.camera : PermissionStatus.granted
I/flutter (10412): Permission.location : PermissionStatus.granted
I/flutter (10412): Permission.locationWhenInUse : PermissionStatus.granted
I/flutter (10412): [true, true, true, true]

Everything is granted, which is how it's supposed to be.

You do get asked every permission you have in the list I assume? Can you try updating to the newest version (version ^8.1.4+2) and run a flutter clean and a flutter pub get?

If this does not work, can you tell me what permissions you request, a flutter doctor -v, what version of Android you're running on/tested it on.

Let me know if you still face this issue or if it's solved so I can close this issue elsewise, thanks in advance!

JDDV avatar Aug 12 '21 11:08 JDDV