flutter-geocoding
flutter-geocoding copied to clipboard
[Bug]: Race condition possibility with `setLocaleIdentifier`
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- [X] Android
- [ ] iOS
Steps to reproduce
In a recent version of flutter-geocoding
, instead of passing the locale identifier as part of the request (e.g. placemarkFromCoordinates(lat, long, localeIdentifier)
, now the user has to first call setLocaleIdentifier(localeIdentifier)
, and then call placemarkFromCoordinates(lat, long)
.
This is problematic if (like in my app) the locale identifier is switching frequently, and there may be more than one reverse geocoding call at a given time (basically I need to be able to reverse geocode into several locales at the same time). There is a race condition, whereby two different threads could interfere with each other's geocoding call.
I know this is an unusual usecase, but the chance for race condition is real, and this is not a good API change.
Expected results
Locale should always be passed in the call (as it is in the currently-released version).
Actual results
Locale is passed in a separate initial step, in the git latest version.
Code sample
N/A
Screenshots or video
N/A
Version
N/A
Flutter Doctor output
N/A
Hi @lukehutch,
Thank you for reporting this issue. We completely agree with your reasoning, however this means we need to do a large refactor of the plugin to manage multiple instances over the different platforms (we need to keep the Dart instances in sync with the matching instances on the native platform).
There is a solution for this and we are planning to apply it. However it will take some time. I will keep this ticket open to track the progress.
Hi, I just upgraded to geocoding
3.0.0, and this is still an issue with this new major-version release. Just wanted to ping you to see if there is any progress on the horizon! Thanks :-)