Skip to content
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

setState not supported #4

Closed
MichalMisiaszek opened this issue Jun 16, 2019 · 10 comments
Closed

setState not supported #4

MichalMisiaszek opened this issue Jun 16, 2019 · 10 comments

Comments

@MichalMisiaszek
Copy link

I want to refresh map and groupings with dynamic list of markers.
The grouping works only first time, if list is empty then updated and setState called map does not refresh. This obviously works on regular map. I attach modified example main to show the problem.

main.dart.txt

@lpongetti
Copy link
Owner

I will try

@MichalMisiaszek
Copy link
Author

I will try

Just use the main.dart I included and you will understand what I mean. Maybe I am doing something wrong but I doubt. On setState after button push the markers array is populated but map does not refresh. Otherwise it seems like great plugin.

@MichalMisiaszek
Copy link
Author

Yes it is fixed. Thanks !

@topnax
Copy link

topnax commented Jun 19, 2019

@MichalMisiaszek does it work for you now? I am currently having the same issue as you.

@topnax
Copy link

topnax commented Jun 19, 2019

The new overridden method didUpdateWidget gets called but does not do anything because listEquals(_markers, options.markers) returns true. How can I update options.markers?

@lpongetti
Copy link
Owner

ok i understand all, i will try to fix this issue.. the probles is that list and marker are by reference. so if you change marker's position for dart the list is not changed

@lpongetti
Copy link
Owner

i dont know how to fix this at the moment.. however you can bypass it by recreating all the markers with the new position

@MichalMisiaszek
Copy link
Author

So I am recreating list in 'build' method on each set State. This works for me.

@lpongetti
Copy link
Owner

@topnax @MichalMisiaszek
issue fixed in 0.1.5
i added an example of state management with this plugin.
If you recreate the list it's perfect but if you change only one marker in the list you have to insert this:
` markers = List.from (markers); `
this create a copy of list and change memory cells's pointers so I can see if there's a change without performance problem

Thanks

@Apollo108
Copy link

Apollo108 commented Jan 11, 2023

@topnax @MichalMisiaszek issue fixed in 0.1.5 i added an example of state management with this plugin. If you recreate the list it's perfect but if you change only one marker in the list you have to insert this: ` markers = List.from (markers); ` this create a copy of list and change memory cells's pointers so I can see if there's a change without performance problem

Thanks

this brings another problem with losing spiderfy state, see #150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants