fixed race condition with map#waitForMap #808
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Multiple attempts have been made to fix the the issue that sometimes on iOS
onStyleLoaded
has does not fire. #775However the error still seems to show up for some users - albeit very rarely.
With this PR im pretty confident to truly fix the issue.
The root cause seems to be that on the native side
onStyleLoaded
fires before the flutter code has even setup the platform callbacks. This causes mainly two kinds of issues:onMapCreated
andonStyleLoaded
being called out of orderonStyleLoaded
not being called at allTo fix it i changed the implementation so that map#waitForMap calls onStyleLoaded if on the map has already finished loading the style. If map#waitForMap happens first onStyleLoaded is called in the mapView callback.
On subsequent style changes mapView always directly calls onStyleLoaded.
@AAverin it would be great if you could check this code with your test code as well - to make sure that is gone for you as well.