Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/216 wrong version #221

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions geocoding/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.1+1

- Reverts changes from version `2.2.1`, `2.2.1` should not be used. Use either version `2.2.1+1` or `3.0.0`.

## 2.2.1

- Updates documentation related to setting the locale.
Expand Down
2 changes: 1 addition & 1 deletion geocoding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import 'package:geocoding/geocoding.dart';
List<Placemark> placemarks = await placemarkFromCoordinates(52.2165157, 6.9437819);
```

The setLocaleIdentifier with the `localeIdentifier` parameter can be used to enforce the results to be formatted (and translated) according to the specified locale. The `localeIdentifier` should be formatted using the syntax: [languageCode]_[countryCode]. Use the [ISO 639-1 or ISO 639-2](http://www.loc.gov/standards/iso639-2/php/English_list.php) standard for the language code and the 2 letter [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard for the country code. Some examples are:
Both the `locationFromAddress` and `placemarkFromCoordinates` accept an optional `localeIdentifier` parameter. This parameter can be used to enforce the results to be formatted (and translated) according to the specified locale. The `localeIdentifier` should be formatted using the syntax: [languageCode]_[countryCode]. Use the [ISO 639-1 or ISO 639-2](http://www.loc.gov/standards/iso639-2/php/English_list.php) standard for the language code and the 2 letter [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard for the country code. Some examples are:

Locale identifier | Description
----------------- | -----------
Expand Down
25 changes: 0 additions & 25 deletions geocoding/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,6 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
});
}),
),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Set locale en_US'),
onPressed: () {
setLocaleIdentifier("en_US").then((_) {
setState(() {});
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('Set locale nl_NL'),
onPressed: () {
setLocaleIdentifier("nl_NL").then((_) {
setState(() {});
});
})),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Expanded(
child: SingleChildScrollView(
child: Container(
Expand Down
36 changes: 22 additions & 14 deletions geocoding/lib/geocoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ export 'package:geocoding_platform_interface/geocoding_platform_interface.dart';
/// However in some situations where the supplied address could not be
/// resolved into a single [Location], multiple [Location] instances may be
/// returned.
Future<List<Location>> locationFromAddress(String address) =>
///
/// Optionally you can specify a locale in which the results are returned.
/// When not supplied the currently active locale of the device will be used.
/// The `localeIdentifier` should be formatted using the syntax:
/// [languageCode]_[countryCode] (eg. en_US or nl_NL).
Future<List<Location>> locationFromAddress(
String address, {
String? localeIdentifier,
}) =>
GeocodingPlatform.instance!.locationFromAddress(
address,
);
Expand All @@ -22,24 +30,19 @@ Future<List<Location>> locationFromAddress(String address) =>
/// However in some situations where the supplied coordinates could not be
/// resolved into a single [Placemark], multiple [Placemark] instances may be
/// returned.
Future<List<Placemark>> placemarkFromCoordinates(
double latitude, double longitude) =>
GeocodingPlatform.instance!.placemarkFromCoordinates(
latitude,
longitude,
);

/// Overrides default locale
///
/// Optionally you can specify a locale in which the results are returned.
/// When not supplied the currently active locale of the device will be used.
/// The `localeIdentifier` should be formatted using the syntax:
/// [languageCode]_[countryCode] (eg. en_US or nl_NL).
Future<void> setLocaleIdentifier(
String localeIdentifier,
) =>
GeocodingPlatform.instance!.setLocaleIdentifier(
localeIdentifier,
Future<List<Placemark>> placemarkFromCoordinates(
double latitude,
double longitude, {
String? localeIdentifier,
}) =>
GeocodingPlatform.instance!.placemarkFromCoordinates(
latitude,
longitude,
);

/// Returns a list of [Location] instances found for the supplied address.
Expand All @@ -48,6 +51,11 @@ Future<void> setLocaleIdentifier(
/// However in some situations where the supplied address could not be
/// resolved into a single [Location], multiple [Location] instances may be
/// returned.
///
/// Optionally you can specify a locale in which the results are returned.
/// When not supplied the currently active locale of the device will be used.
/// The `localeIdentifier` should be formatted using the syntax:
/// [languageCode]_[countryCode] (eg. en_US or nl_NL).
Future<bool> isPresent({
String? localeIdentifier,
}) =>
Expand Down
4 changes: 2 additions & 2 deletions geocoding/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: geocoding
description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features.
version: 2.2.1
version: 2.2.1+1
repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding
issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues

Expand All @@ -14,7 +14,7 @@ dependencies:

geocoding_platform_interface: ^3.0.0
geocoding_android: ^3.0.0
geocoding_ios: ^3.0.0
geocoding_ios: ^2.0.0

dev_dependencies:
flutter_test:
Expand Down
10 changes: 6 additions & 4 deletions geocoding/test/geocoding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,18 @@ class MockGeocodingPlatform extends Mock
GeocodingPlatform {
@override
Future<List<Location>> locationFromAddress(
String address,
) async {
String address, {
String? localeIdentifier,
}) async {
return [mockLocation];
}

@override
Future<List<Placemark>> placemarkFromCoordinates(
double latitude,
double longitude,
) async {
double longitude, {
String? localeIdentifier,
}) async {
return [mockPlacemark];
}
}