Skip to content

[Bug]: Geocoding(locale: ...) has no effect – locale is not forwarded to _fromPlatformCreationParams #324

Open

Description

@jholsten

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS

Steps to reproduce

  1. Set the device language to something other than German (e.g. English).
  2. Create a Geocoding instance with an explicit locale: Geocoding(locale: const Locale('de', 'DE')).
  3. Call placemarkFromCoordinates for a location in Germany (e.g. 52.5163, 13.3777, Brandenburger Tor, Berlin).
  4. Inspect the returned Placemark, e.g. placemark.country.

Expected results

The placemarks are returned in the locale passed to the constructor (de_DE), e.g. country == 'Deutschland'.

Actual results

The locale passed to the constructor is ignored. The placemarks come back in the device locale, e.g. country == 'Germany'.

The cause is in the public Geocoding constructor: it accepts locale, but does not forward it to the private factory Geocoding._fromPlatformCreationParams, so the value never reaches the platform implementation.

Proposed fix – forward the parameter:

Geocoding({Locale? locale})
    : this._fromPlatformCreationParams(
        pi.GeocodingCreationParams(),
        locale: locale,
      );

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:geocoding/geocoding.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: ElevatedButton(
            onPressed: _reverseGeocode,
            child: Text('Reverse geocode'),
          ),
        ),
      ),
    );
  }
}

Future<void> _reverseGeocode() async {
  final geocoding = Geocoding(locale: const Locale('de', 'DE'));
  final placemarks = await geocoding.placemarkFromCoordinates(52.5163, 13.3777);

  // Device language set to English:
  // Expected: "Deutschland"
  // Actual:   "Germany"
  debugPrint(placemarks.first.country);
}

Screenshots or video

Version

5.0.0

Flutter Doctor output

Doctor output

(Irrelevant)

Activity

  1. AmrWalidi commented on Oct 31, 2026

    @AmrWalidi

    Hi! I'd like to work on this issue as my first contribution to the project.

    I'll investigate why the locale parameter isn't forwarded to the platform creation parameters and try to provide a fix with a regression test.

    Is this issue still available to work on?

    Thank you!

  2. mvanbeusekom commented on Oct 31, 2026

    @mvanbeusekom
    Member

    Yes it is still open and contributions are very much appreciated.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions