onChange property

Stream<St> onChange

A stream that emits the current state when it changes.

Example

// Create the Store;
final store = new Store<int>(initialState: 0);

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

// Dispatch some actions, which prints the state.
store.dispatch(IncrementAction());

// When you want to stop printing, cancel the subscription.
subscription.cancel();

Implementation

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