https://pub.flutter-io.cn/packages/permission_handler
https://www.jianshu.com/p/fa68876fbdfd
例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Future requestPermission() async { // 申请权限 Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.storage]); // 申请结果 PermissionStatus permission = await PermissionHandler() .checkPermissionStatus(PermissionGroup.storage); if (permission == PermissionStatus.granted) { print("权限申请通过"); } else { print("权限申请通过"); } } } |