Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen Anfängerfreundlich
#324 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
92/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
dart, flutter

Rechercherichtung

Beginne beim öffentlichen Geocoding-Konstruktor und seiner _fromPlatformCreationParams-Factory, die laut Issue die Stelle ist, an der locale verworfen wird. Prüfe, wie die Factory locale an die Plattformimplementierung weitergibt, leite dann das Konstruktorargument weiter und stelle sicher, dass eine explizit angegebene locale sie erreicht. Fertig, wenn die angegebene deutsche locale statt der Gerätesprache verwendet wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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)

Vorherrschende Sprache
Dart
Sterne
153
Forks
92
Ø Merge
7 T. 21 Std.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Baseflow/flutter-geocoding

Alle Issues in Baseflow/flutter-geocoding

Ähnliche Issues

Weitere Issues zu Dart

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.