Skip to content

Fixes locale being ignored in geocoding constructor (#324) - #325

Merged
mvanbeusekom merged 2 commits into
Baseflow:mainfrom
jholsten:main
Oct 28, 2026
Merged

mvanbeusekom merged 2 commits into
Baseflow:mainfrom
jholsten:main

Conversation

@jholsten

@jholsten jholsten commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

The locale passed to the Geocoding constructor was silently ignored (see #324). The public constructor forwarded to Geocoding._fromPlatformCreationParams without the locale argument, so the internal _locale was always null. As a result, locationFromAddress, placemarkFromAddress and placemarkFromCoordinates fell back to the device locale unless a locale was passed to each call individually.

Before:

final geocoding = Geocoding(locale: const Locale('nl', 'NL'));
// Results were returned in the device locale, not in nl_NL.
await geocoding.placemarkFromCoordinates(52.2165157, 6.9437819);

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • This PR only changes one package (or documents why an exception is needed).
  • 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 with a new ## x.y.z section that matches the version in pubspec.yaml
  • I updated/added relevant documentation (doc comments with ///).
  • 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.

Copilot AI balanced review requested due to automatic review settings October 28, 2026 11:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change forwarding the constructor locale to geocoding calls.

No open issues 🎉

What changed in this PR

Fixes #324 by forwarding the constructor’s locale to the internal Geocoding factory, allowing geocoding calls to use the configured locale by default.

Changes:

  • Preserves the constructor locale while allowing per-call overrides.
  • Adds regression tests for constructor locale handling across all three geocoding methods and a method-level override.
  • Bumps the package to 5.0.1 and documents the fix.
File Description
geocoding/​test/​geocoding_test.dart Adds locale regression tests and locale tracking in the platform mock.
geocoding/​pubspec.yaml Updates the package version to 5.0.1.
geocoding/​lib/​geocoding.dart Forwards the constructor locale to the internal factory.
geocoding/​CHANGELOG.md Records the locale fix for release 5.0.1.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 28, 2026 13:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test file cannot compile because of a duplicate method and invalid constructor calls, and the mock factory must return the supplied mock for the locale assertions to observe calls.

3 open issues

Review effort: Balanced


setUp(() {
GeocodingPlatformFactory.instance = MockGeocodingPlatformFactory();
platform = MockGeocodingPlatform();
GeocodingPlatformFactory.instance = MockGeocodingPlatformFactory();
platform = MockGeocodingPlatform();
GeocodingPlatformFactory.instance =
MockGeocodingPlatformFactory(platform);
}

@override
Future<List<Placemark>> placemarkFromAddress(
@mvanbeusekom
mvanbeusekom merged commit 056a1eb into Baseflow:main Oct 28, 2026
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.

4 participants