Skip to content

permission_handler_windows: lazily create Geolocator#1546

Open
skylartaylor wants to merge 1 commit into
Baseflow:mainfrom
prismplural:fix/windows-lazy-geolocator
Open

permission_handler_windows: lazily create Geolocator#1546
skylartaylor wants to merge 1 commit into
Baseflow:mainfrom
prismplural:fix/windows-lazy-geolocator

Conversation

@skylartaylor

@skylartaylor skylartaylor commented Jul 3, 2026

Copy link
Copy Markdown

permission_handler_windows currently creates a Windows Geolocator and subscribes to PositionChanged while the plugin is registering. That can make apps appear to access location even when they only depend on permission_handler and never request location.

This PR removes the eager Geolocator member and PositionChanged subscription. Geolocator is now created only inside IsLocationServiceEnabled(), so location service-status checks still work without touching the Windows location API during plugin registration.

Fixes #983.
Fixes #1394.
Related to #1470 and #1389.

Verification performed:

  • flutter pub get in permission_handler_windows
  • dart format --set-exit-if-changed . in permission_handler_windows
  • flutter analyze in permission_handler_windows
  • flutter analyze in permission_handler_windows/example
  • flutter test in permission_handler_windows reports no test/ directory, so there is no package test suite for this change
  • Fork-only Windows smoke: https://github.com/prismplural/flutter-permission-handler/actions/runs/28682163749, example app location registry entries stayed unchanged (0 before launch, 0 after launch)
  • Downstream Prism Windows smoke: https://github.com/prismplural/prism-app/actions/runs/28686868188, Prism resolved this fork, built and launched prism_plurality.exe, and location registry entries stayed unchanged (1 before launch, 1 after launch)

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///), or this PR does not need documentation changes.
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows shows app as constantly using the device's location Bug: location tracking in windows

1 participant