Skip to content

Commit

Permalink
Expose isPresent platform interface (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHoogstrate authored Feb 15, 2024
1 parent f13ea3f commit aa902f6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions geocoding_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.2.0

- Adds `isPresent` method to the platform interface.

## 3.1.0

- Adds `placemarkFromAddress` method to the platform interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ abstract class GeocodingPlatform extends PlatformInterface {
'locationFromAddress() has not been implementated.');
}

/// Returns true if there is a geocoder implementation present that may return results.
/// If true, there is still no guarantee that any individual geocoding attempt will succeed.
///
///
/// This method is only implemented on Android, calling this on iOS always
/// returns [true].
Future<bool> isPresent() {
throw UnimplementedError('isPresent() has not been implementated.');
}

/// Returns a list of [Placemark] instances found for the supplied
/// coordinates.
///
Expand Down
2 changes: 1 addition & 1 deletion geocoding_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the geocoding plugin.
homepage: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 3.1.0
version: 3.2.0

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ void main() {
);
});

test(
// ignore: lines_longer_than_80_chars
'Default implementation of isPresent should throw unimplemented error',
() {
// Arrange
final geocodingPlatform = ExtendsGeocodingPlatform();

// Act & Assert
expect(
() => geocodingPlatform.isPresent(),
throwsUnimplementedError,
);
});

test(
// ignore: lines_longer_than_80_chars
'Default implementation of placemarkFromCoordinates should throw unimplemented error',
Expand Down

0 comments on commit aa902f6

Please sign in to comment.