flutter_redux icon indicating copy to clipboard operation
flutter_redux copied to clipboard

[Question]: Mixing global and local state

Open hffmnn opened this issue 4 years ago • 0 comments

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?

hffmnn avatar Oct 12 '21 19:10 hffmnn