onChange property

Stream<State> onChange

A stream that emits the current state when it changes.


// First, create the Store
final store = new Store<int>(counterReducer, 0);

// Next, listen to the Store's onChange stream, and print the latest
// state to your console whenever the reducer produces a new State.
// We'll store the StreamSubscription as a variable so we can stop
// listening later.
final subscription = store.onChange.listen(print);

// Dispatch some actions, and see the printing magic!
store.dispatch("INCREMENT"); // prints 1
store.dispatch("INCREMENT"); // prints 2
store.dispatch("DECREMENT"); // prints 1

// When you want to stop printing the state to the console, simply
`cancel` your `subscription`.


Stream<State> get onChange => _changeController.stream;