-
-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RangeError (index): Invalid value: Valid value range is empty: 0 #1146
Comments
Is there a specific line it points to with the error ? |
24 FlutterMap() |
When i start scrolling on the screen everything is ok |
Bit technical, just in case someone else reads as well and has some ideas, as I'm a bit tied up atm, but may get chance to have a better look later.. A quick rummage...(so may be off target) I think there's a bug in FlutterMaps MarkerLayer, where it barfs if the pxCache has a different number of markers to the actual number markers. So I think this may happen a lot in cases where people add new markers... I note we regenerate pxCache if didUpdateWidget is called or the zoom changes...maybe it needs to also be called if px cache size is different to marker list size as well.... Suggestion for fluttermap bug fix.
Not entirely happy with that though, as I guess its possible values may have changed but size the same.... |
so, just thinking out loud on this a bit more. Let's assume someone may have 10,000 markers, projections internally cached, not in view, and they change the last marker LatLng which makes it now come in view. What should happen ? A length check (which I think would fix the crash and maybe ok as a very temp solution), wouldn't help here. So what are the options ?
Not sure I like any of those :D, anyone else have any ideas (or am I missing something and the issue is wrong)? |
There's a PR at #1147 to get around the problem if you wanted a test. Digging into it a bit more, you may be able to scrape by without the crash and PR by calling a setState({}) after you add the marker (which is probably wise anyway to update the display). |
Going to close this, but feel free to reopen if #1147 doesn't fix the problem for you. |
Can anyone tell me what i did wrong?
This is the problem:
The relevant error-causing widget was FlutterMap
RangeError (index): Invalid value: Valid value range is empty: 0
The text was updated successfully, but these errors were encountered: