Baseflow / flutter-geocoding

A Geocoding plugin for Flutter
https://baseflow.com
MIT License
134 stars 69 forks source link

[Bug]: Android backend needs to switch to the async API #195

Closed lukehutch closed 5 months ago

lukehutch commented 5 months ago

Please check the following before submitting a new issue.

Please select affected platform(s)

Steps to reproduce

The Android Geocoder docs say:

Warning: This API may hit the network, and may block for excessive amounts of time, up to 60 seconds or more. It's strongly encouraged to use the asynchronous version of this API. If that is not possible, this should be run on a background thread to avoid blocking other operations.

Expected results

Both the calls in the Android backend use the synchronous API, on the UI thread:

return geocoder.getFromLocationName(address, 5);
return geocoder.getFromLocation(latitude, longitude, 5);

Instead, these should be switched to the asynchronous API, which takes an additional callback parameter of type Geocoder.GeocodeListener.

Actual results

Currently the blocking API is used.

Code sample

N/A

Screenshots or video

N/A

Version

latest

Flutter Doctor output

N/A

TimHoogstrate commented 5 months ago

Fixed by (https://github.com/Baseflow/flutter-geocoding/pull/197)