Store<S extends StoreState> class Null safety

Creates a store that holds the app's state.

The only way to change the state in the store is to dispatch an action. The action will be sent to the provided Reducer to update the state.

Only after a new state is computed will the dispatched action be added to the stream of actions that is provided to each Effect.

Constructors

Store({required S initialState, Reducer<S>? reducer, List<Effect<S>>? effects})

Properties

effects List<Effect<S>>?
A list of effects to be run after a new state is computed.
read / write
hashCode int
The hash code for this object.
read-onlyinherited
reducer Reducer<S>?
A function that takes a StoreAction and a State, and returns a new State.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
state BehaviorSubject<S>
The store's state.
final
value → S
The current value of the state in the store.
read-only

Methods

dispatch(StoreAction action) → dynamic
Dispatch a new action.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
select<R, P>(Selector<S, R> selector, [dynamic props]) Stream<R>
Stream the state of the of the store given a Selector.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited