这是我的代码:
_askPermission() async {
if (Platform.isIOS) {
Map<PermissionGroup , PermissionStatus> permissions =
await PermissionHandler()
.requestPermissions([PermissionGroup.photos]);
} else {
PermissionStatus permission = await PermissionHandler()
.checkPermissionStatus(PermissionGroup.storage);
}
}
如果我没有错的话,您正在使用这个包:https://pub.dev/packages/permission_handler,在这个包中我没有看到
PermissionHandler()或PermissionGroup()
如果希望请求批量,则应该这样做
Map<Permission, PermissionStatus> statuses = await [
Permission.location,
Permission.storage,
].request();
print(statuses[Permission.location]);
查看此以获取更多帮助。https://stackoverflow.com/A/64646086/10711216