Skip to content

Commit aa902f6

Browse files
Expose isPresent platform interface (#202)
1 parent f13ea3f commit aa902f6

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

geocoding_platform_interface/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.2.0
2+
3+
- Adds `isPresent` method to the platform interface.
4+
15
## 3.1.0
26

37
- Adds `placemarkFromAddress` method to the platform interface.

geocoding_platform_interface/lib/src/geocoding_platform_interface.dart

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ abstract class GeocodingPlatform extends PlatformInterface {
5858
'locationFromAddress() has not been implementated.');
5959
}
6060

61+
/// Returns true if there is a geocoder implementation present that may return results.
62+
/// If true, there is still no guarantee that any individual geocoding attempt will succeed.
63+
///
64+
///
65+
/// This method is only implemented on Android, calling this on iOS always
66+
/// returns [true].
67+
Future<bool> isPresent() {
68+
throw UnimplementedError('isPresent() has not been implementated.');
69+
}
70+
6171
/// Returns a list of [Placemark] instances found for the supplied
6272
/// coordinates.
6373
///

geocoding_platform_interface/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the geocoding plugin.
33
homepage: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 3.1.0
6+
version: 3.2.0
77

88
dependencies:
99
flutter:

geocoding_platform_interface/test/geocoding_platform_interface_test.dart

+14
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ void main() {
5151
);
5252
});
5353

54+
test(
55+
// ignore: lines_longer_than_80_chars
56+
'Default implementation of isPresent should throw unimplemented error',
57+
() {
58+
// Arrange
59+
final geocodingPlatform = ExtendsGeocodingPlatform();
60+
61+
// Act & Assert
62+
expect(
63+
() => geocodingPlatform.isPresent(),
64+
throwsUnimplementedError,
65+
);
66+
});
67+
5468
test(
5569
// ignore: lines_longer_than_80_chars
5670
'Default implementation of placemarkFromCoordinates should throw unimplemented error',

0 commit comments

Comments
 (0)