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

Updated app facing package and implemented isPresent() in example project #205

16 changes: 15 additions & 1 deletion geocoding/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,21 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
if (locations.isNotEmpty) {
output = locations[0].toString();
}

setState(() {
_output = output;
});
});
}),
),
const Padding(
padding: EdgeInsets.only(top: 8),
),
Center(
child: ElevatedButton(
child: Text('is Present'),
onPressed: () {
isPresent().then((isPresent) {
var output = isPresent ? 'Is present' : 'Is not present';
setState(() {
_output = output;
});
Expand Down
22 changes: 18 additions & 4 deletions geocoding/lib/geocoding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ Future<List<Location>> locationFromAddress(
String address, {
String? localeIdentifier,
}) =>
GeocodingPlatform.instance.locationFromAddress(
GeocodingPlatform.instance!.locationFromAddress(
address,
localeIdentifier: localeIdentifier,
);

/// Returns a list of [Placemark] instances found for the supplied
Expand All @@ -41,8 +40,23 @@ Future<List<Placemark>> placemarkFromCoordinates(
double longitude, {
String? localeIdentifier,
}) =>
GeocodingPlatform.instance.placemarkFromCoordinates(
GeocodingPlatform.instance!.placemarkFromCoordinates(
latitude,
longitude,
localeIdentifier: localeIdentifier,
);

/// Returns a list of [Location] instances found for the supplied address.
///
/// In most situations the returned list should only contain one entry.
/// 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,
}) =>
GeocodingPlatform.instance!.isPresent();
6 changes: 3 additions & 3 deletions geocoding/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ dependencies:
flutter:
sdk: flutter

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

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion geocoding/test/geocoding_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final mockLocation = Location(
timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(),
);

final mockPlacemark = Placemark(
const mockPlacemark = Placemark(
administrativeArea: 'Overijssel',
country: 'Netherlands',
isoCountryCode: 'NL',
Expand Down