File tree 6 files changed +53
-1
lines changed
android/src/main/java/com/baseflow/geocoding
example/lib/plugin_example
6 files changed +53
-1
lines changed Original file line number Diff line number Diff line change
1
+ ## 3.2.0
2
+
3
+ * Exposes isPresent() call that returns true if there is a geocoder implementation present that may return results.
4
+
1
5
## 3.1.0
2
6
3
7
* Fixes deprecation build warnings.
Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ void setLocaleIdentifier(@Nullable Locale locale) {
36
36
this .locale = locale ;
37
37
}
38
38
39
+ /**
40
+ * Returns true if there is a geocoder implementation present that may return results.
41
+ * If true, there is still no guarantee that any individual geocoding attempt will succeed.
42
+ *
43
+ */
44
+ boolean isPresent () {
45
+ return Geocoder .isPresent ();
46
+ }
47
+
39
48
/**
40
49
* Returns a list of Address objects matching the supplied address string.
41
50
*
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ public void onMethodCall(
55
55
case "placemarkFromCoordinates" :
56
56
onPlacemarkFromCoordinates (call , result );
57
57
break ;
58
+ case "isPresent" :
59
+ onIsPresent (call , result );
60
+ break ;
58
61
default :
59
62
result .notImplemented ();
60
63
break ;
@@ -203,4 +206,9 @@ public void onError(String errorMessage) {
203
206
}
204
207
});
205
208
}
209
+
210
+ private void onIsPresent (final MethodCall call , final Result result ) {
211
+ boolean isPresent = geocoding .isPresent ();
212
+ result .success (isPresent );
213
+ }
206
214
}
Original file line number Diff line number Diff line change @@ -154,6 +154,23 @@ class _GeocodeWidgetState extends State<GeocodeWidget> {
154
154
});
155
155
}),
156
156
),
157
+ const Padding (
158
+ padding: EdgeInsets .only (top: 8 ),
159
+ ),
160
+ Center (
161
+ child: ElevatedButton (
162
+ child: Text ('Is present' ),
163
+ onPressed: () {
164
+ GeocodingAndroid ().isPresent ().then ((isPresent) {
165
+ var output = isPresent
166
+ ? "Geocoder is present"
167
+ : "Geocoder is not present" ;
168
+ setState (() {
169
+ _output = output;
170
+ });
171
+ });
172
+ }),
173
+ ),
157
174
Expanded (
158
175
child: SingleChildScrollView (
159
176
child: Container (
Original file line number Diff line number Diff line change @@ -44,6 +44,20 @@ class GeocodingAndroid extends GeocodingPlatform {
44
44
}
45
45
}
46
46
47
+ @override
48
+ Future <bool > isPresent () async {
49
+ try {
50
+ final isPresent = await _channel.invokeMethod (
51
+ 'isPresent' ,
52
+ );
53
+
54
+ return isPresent;
55
+ } on PlatformException catch (e) {
56
+ _handlePlatformException (e);
57
+ rethrow ;
58
+ }
59
+ }
60
+
47
61
@override
48
62
Future <List <Placemark >> placemarkFromCoordinates (
49
63
double latitude,
Original file line number Diff line number Diff line change 1
1
name : geocoding_android
2
2
description : A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features.
3
- version : 3.1 .0
3
+ version : 3.2 .0
4
4
repository : https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_android
5
5
issue_tracker : https://github.com/Baseflow/flutter-geocoding/issues
6
6
You can’t perform that action at this time.
0 commit comments