Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#324 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
92/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
dart, flutter

調査の方向性

公開 Geocoding コンストラクターと、その factory である _fromPlatformCreationParams から確認してください。Issue では、ここが locale が失われる箇所として示されています。factory が locale をプラットフォーム実装にどう渡すかを確認し、コンストラクターの引数を転送して、明示的に指定した locale が届くことを検証してください。報告されたドイツ語の locale がデバイスの locale の代わりに使われれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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)

主要言語
Dart
スター
153
フォーク
92
平均マージ
7日 21時間
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Baseflow/flutter-geocoding のほかの issue

Baseflow/flutter-geocoding の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。