[Bug]: `Geocoding(locale: ...)` has no effect – locale is not forwarded to `_fromPlatformCreationParams`
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 92/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
公開 Geocoding コンストラクターと、その factory である _fromPlatformCreationParams から確認してください。Issue では、ここが locale が失われる箇所として示されています。factory が locale をプラットフォーム実装にどう渡すかを確認し、コンストラクターの引数を転送して、明示的に指定した locale が届くことを検証してください。報告されたドイツ語の locale がデバイスの locale の代わりに使われれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Please check the following before submitting a new issue.
- I have searched the existing issues.
- I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- Android
- iOS
Steps to reproduce
- Set the device language to something other than German (e.g. English).
- Create a
Geocodinginstance with an explicit locale:Geocoding(locale: const Locale('de', 'DE')). - Call
placemarkFromCoordinatesfor a location in Germany (e.g.52.5163, 13.3777, Brandenburger Tor, Berlin). - 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Baseflow/flutter-geocoding のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
Baseflow/flutter-geocoding#311 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Baseflow/flutter-geocoding#309 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 49/100
Baseflow/flutter-geocoding#327 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
Baseflow/flutter-geocoding#287 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
Baseflow/flutter-geocoding#286 · コメント 2 件 ·
Baseflow/flutter-geocoding の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Tencent/tdesign-flutter#1229 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
berkmancenter/frankly#732 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
rodydavis/signals.dart#510 ·
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
pentakoron1/brazier#33 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
LonelyGriffin/noetec#51 ·