Skip to content

Commit

Permalink
updates locale documentation for geolocator
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHoogstrate committed Mar 4, 2024
1 parent b0d3040 commit eac0900
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 30 deletions.
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

- Updates documentation related to setting the locale.

## 2.2.0

- Exposes the `isPresent()` method which on Android returns `true` if the
Expand Down
36 changes: 14 additions & 22 deletions geocoding/lib/geocoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ 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.
///
/// 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,
}) =>
Future<List<Location>> locationFromAddress(String address) =>
GeocodingPlatform.instance!.locationFromAddress(
address,
);
Expand All @@ -30,19 +22,24 @@ Future<List<Location>> locationFromAddress(
/// 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<List<Placemark>> placemarkFromCoordinates(
double latitude,
double longitude, {
String? localeIdentifier,
}) =>
GeocodingPlatform.instance!.placemarkFromCoordinates(
latitude,
longitude,
Future<void> setLocaleIdentifier(
String localeIdentifier,
) =>
GeocodingPlatform.instance!.setLocaleIdentifier(
localeIdentifier,
);

/// Returns a list of [Location] instances found for the supplied address.
Expand All @@ -51,11 +48,6 @@ Future<List<Placemark>> placemarkFromCoordinates(
/// 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
2 changes: 1 addition & 1 deletion 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.0
version: 2.2.1
repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding
issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues

Expand Down
10 changes: 3 additions & 7 deletions geocoding/test/geocoding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,15 @@ class MockGeocodingPlatform extends Mock
implements
GeocodingPlatform {
@override
Future<List<Location>> locationFromAddress(
String address, {
String? localeIdentifier,
}) async {
Future<List<Location>> locationFromAddress(String address) async {
return [mockLocation];
}

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

0 comments on commit eac0900

Please sign in to comment.