diff --git a/geocoding/example/lib/main.dart b/geocoding/example/lib/main.dart index f93aefa..20f4290 100644 --- a/geocoding/example/lib/main.dart +++ b/geocoding/example/lib/main.dart @@ -115,7 +115,21 @@ class _GeocodeWidgetState extends State { 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; }); diff --git a/geocoding/lib/geocoding.dart b/geocoding/lib/geocoding.dart index eec7c4b..df8ff63 100644 --- a/geocoding/lib/geocoding.dart +++ b/geocoding/lib/geocoding.dart @@ -19,9 +19,8 @@ Future> locationFromAddress( String address, { String? localeIdentifier, }) => - GeocodingPlatform.instance.locationFromAddress( + GeocodingPlatform.instance!.locationFromAddress( address, - localeIdentifier: localeIdentifier, ); /// Returns a list of [Placemark] instances found for the supplied @@ -41,8 +40,23 @@ Future> 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 isPresent({ + String? localeIdentifier, +}) => + GeocodingPlatform.instance!.isPresent(); diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index ce02e39..9ac24f7 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -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: diff --git a/geocoding/test/geocoding_test.dart b/geocoding/test/geocoding_test.dart index 752892a..38f2637 100644 --- a/geocoding/test/geocoding_test.dart +++ b/geocoding/test/geocoding_test.dart @@ -9,7 +9,7 @@ final mockLocation = Location( timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(), ); -final mockPlacemark = Placemark( +const mockPlacemark = Placemark( administrativeArea: 'Overijssel', country: 'Netherlands', isoCountryCode: 'NL',