Baseflow / Baseflow/flutter-permission-handler
[Bug]: Permission.locationAlways.request doesn't wait for selection in system dialog
- Dominant language
- Dart
- Stars
- 2.2k
- Forks
- 970
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 2
Description
### Please check the following before submitting a new issue.
- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
- [x] I have carefully [read the documentation](https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration.
### Please select affected platform(s)
- [ ] Android
- [x] iOS
- [ ] Windows
### Steps to reproduce
When calling `await Permission.locationAlways.request()` system dialog is shown but lib is not waiting for a selection, instead it just returns .denied.
### Expected results
To wait for a selection in location permission system dialog.
### Actual results
PermissionStatus.denied is returned right away.
### Code sample
Code sample
```dart
import 'dart:async';
import 'package:permission_handler/permission_handler.dart';
import 'package:vegetation_manager/common/helper/location_permission_manager.dart';
final class LocationPermissionManagerImpl implements LocationPermissionManager {
@override
Future isLocationAlwaysAllowed() async {
var locationAlwaysStatus = await Permission.locationAlways.status;
if (!locationAlwaysStatus.isGranted) {
final whenInUseStatus = await Permission.locationWhenInUse.request();
if (whenInUseStatus.isGranted) {
// Not waiting for user to choose option in dialog, instead returning .denied right away
locationAlwaysStatus = await Permission.locationAlways.request();
return locationAlwaysStatus.isGranted;
}
return false;
}
return true;
}
}
```
### Screenshots or video
Screenshots or video demonstration
[Upload media here]
### Version
11.4.0
### Flutter Doctor output
Doctor output
```console
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.0, on macOS 15.3.1 24D70 darwin-arm64, locale en-RS)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.98.0)
[✓] Connected device (5 available)
[✓] Network resources
• No issues found!
```
Contributor guide
Assessment
This issue has not been assessed yet.