marcglasberg / async_redux

Flutter Package: A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate. Allows for both sync and async reducers.
Other
230 stars 41 forks source link

Ability to suppress state change events #74

Closed parisholley closed 4 years ago

parisholley commented 4 years ago

I need a way to create an "aggregate" action, (a redux action, that delegates via dispatch to other actions) and only produce a single change event. Otherwise, I introduce a lot of onChange overhead to flutter widgets. Existing methods (eg: reduceWithState) cause mutation and throw safety away.

Practical use case is for listening to a universal URL and booting the app state for the first time (no persisted state), and wanting to bootstrap the entire UI via dispatches, before rending the first frame. Without this PR, there is a lot of jitteriness...

The implementation was done in a backwards compatible way, but I would make the case that notify = false should be the default behavior when calling dispatch/dispatchFuture from within a ReduxAction.