Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #1583 +/- ##
===========================================
- Coverage 89.84% 71.42% -18.42%
===========================================
Files 7 1 -6
Lines 128 35 -93
===========================================
- Hits 115 25 -90
+ Misses 13 10 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Dec 1, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Location requests on iOS could return before the user answered the prompt, or never return:
locationAlwaysafter "When In Use" returneddeniedas soon as the upgrade prompt appeared, because the delegate repeats the current When In Use status right afterrequestAlwaysAuthorization([Bug]: Requesting locationAlways does not await user's response. #1152, [Bug]: Permission.locationAlways.request doesn't wait for selection in system dialog #1457).ERROR_ALREADY_REQUESTING_PERMISSIONS(iOS: Permission prompt disapears on screen lock and await never completes. #1035, [Bug]:Lock the screen when the address permission is enabled,PlatformException(ERROR_ALREADY_REQUESTING_PERMISSIONS, A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time)., null, null) #1261).Fixes #1152
Fixes #1457
Fixes #1035
Fixes #1261
As proposed in #1152 (comment), a location request now ends in one of three ways:
Always is now marked as asked only when its prompt actually appeared. Before, the flag was set when
requestAlwaysAuthorizationwas called, so after "Allow Once" a later Always request returnedpermanentlyDeniedwithout asking.Behavior changes to note:
locationAlwaysreturnsdeniedafter 2 seconds instead of right away.CLLocationManagerinstance on iOS 14 and later, as the olddidBecomeActivehandler did, instead of the deprecated class method. This lets the tests inject a location manager.Tests:
LocationPermissionStrategyTestsin the example'sRunnerTestscreates the strategy with a fakeCLLocationManager, its own notification center and user defaults, and a short prompt timeout. It covers both choices in the upgrade prompt, the request without a prompt, asking again after it, the already-asked case, and When In Use granted or dismissed. The test target reads the private strategy header throughHEADER_SEARCH_PATHSand looks the class up at runtime, since the plugin is linked into the app.I also ran each case by hand on an iOS 26.5 simulator with this change, reinstalling the app before each case:
request()returnedlocationAlways, tap "Change to Always Allow"grantedwhen tapped (13.9 s)permanentlyDeniedwhen tapped (8.0 s). A second request returnspermanentlyDeniedin 6 ms.locationAlwaysdeniedafter 2.1 s, with no promptlocationAlwaysgrantedwhen tappedlocationWhenInUse, lock the screen while the prompt is showingdeniedwhen the screen locks (8.8 s). After unlocking, the next request shows the prompt again.I haven't tested on a physical device or on iOS versions other than 26.5. CI doesn't run the example's
RunnerTests, so I ran them locally (8 tests pass), along withdart format,flutter analyzeand the example release build with the release flavor selected.Pre-launch Checklist
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.CHANGELOG.mdto add a description of the change.///).main.dart format .and committed any changes.flutter analyzeand fixed any errors.