brianegan / flutter_redux

A library that connects Widgets to a Redux Store
MIT License
1.65k stars 219 forks source link

[Question]: Mixing global and local state #222

Open hffmnn opened 2 years ago

hffmnn commented 2 years ago

Using the StoreConnector it looks to me like all of the view models properties must be derived from the current store data. But what if I want to have some data that should be kept local to the view. Let's say I want to e.g. show an alert once based on an exception that is part of the redux state. For this, I would have a property like showedExceptionAlert in the view model. But whenever the view model gets regenerated the value of this property would get overridden. And I don't want to go the full redux way via actions, reducer... just because of a simple, local-only property.

For sure I could keep this data in the view, but that feels a little bit wrong to have two places to look for the current state.

Another option would be to mix e.g. the bloc pattern with redux but this also seems a little bit too much for such a simple task.

So the question is: Is there something like a pattern to have local and global (redux) state in one view model?