[Bug]: `Geocoding(locale: ...)` has no effect – locale is not forwarded to `_fromPlatformCreationParams`
@AmrWalidi đang làm issue này rồi.
Từ ngày 31/10/2026.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 92/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend-api-design, mobile
Hướng nghiên cứu
Bắt đầu từ constructor công khai Geocoding và factory _fromPlatformCreationParams của nó, nơi issue xác định là điểm locale bị loại bỏ. Kiểm tra cách factory truyền locale đến phần triển khai của nền tảng, sau đó chuyển tiếp đối số của constructor và xác minh rằng locale được chỉ định tường minh đến được phần triển khai đó. Hoàn tất khi locale tiếng Đức được báo cáo được sử dụng thay cho locale của thiết bị.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- Dart
- Star
- 153
- Fork
- 92
- Merge trung bình
- 7 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Baseflow/flutter-geocoding
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
Baseflow/flutter-geocoding#311 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Baseflow/flutter-geocoding#309 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 49/100
Baseflow/flutter-geocoding#327 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Baseflow/flutter-geocoding#287 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Baseflow/flutter-geocoding#286 · 2 bình luận ·
Tất cả issue của Baseflow/flutter-geocoding
Issue tương tự
-
area/adaptivity kind/task priority/p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
accessibility good first issue user interface
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
pentakoron1/brazier#37 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue help wanted priority: low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
TanbirRamim/show-receipts#33 ·
Maintainer thường phản hồi trong vòng 1 ngày