Reputation: 2814
I need manage the states globally, I find a lot of way, in terms of managing the state by using Provider
bloc pattern
redux
and etc.
But actually I dont know, which one is faster and performant?
Example: I am working on chat application, which I have to manage socket connection
messages
online offline status
all as globally. the states need to be accessible from all screen, like ChatList
screen, ChatBox
screen and more...
Upvotes: 0
Views: 2467
Reputation: 1243
I didn't test them all performance wise. And i do not think it will make much of a difference.
Provider works with inheritedwidget as scoped model i think. I love the streams for the versatility of the data flow.... i think the key part for performance is to keep the rebuilding/painting of the widgets that require it at the lowest level of the tree.
get_it package should help you to keep those streams accessible everywhere, is a great simple package to keep neat model access, regarding the state management solution.
For instance, i believe that generating statelessstateful widgets instead of functions that returns widgets to make the layout, provides more performance, for the separation of buildcontexts. In any case, the framework is super optimized and performant... if u run into any issue, u can easily track it down with the devtools and the community is very supportive.
Btw, take my basic reply with a grain of salt, as I've been only playing with flutter/dart for a week.
Upvotes: 2