Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter redux StoreConnector vs StoreBuilder

I am using Flutter redux for state management and what I don't understand is why do we have both StoreConnectorand StoreBuilder?
What is the difference between the two, other than the parameters they except?
Is there a specific reason as to when should we use any one of them?

like image 324
Flake Avatar asked May 20 '18 09:05

Flake


1 Answers

The difference is basically on the scope of changes.

I'd recommend for the StoreConnector pretty much every time, except for very simple cases.

StoreBuilder always listens on the entire store. StoreConnector converts the store to a widget-specific viewmodel; this is what lets redux be smart about what parts of the tree need be updated when the store changes.

If you have StoreBuilders everywhere, all of them will be updated every time there is a change in the store.

like image 159
Edman Avatar answered Oct 23 '22 04:10

Edman