DevToolsStore<S> class

The DevToolsStore is a drop-in replacement for a normal Redux Store that should only be used during Development, allowing you to "Time Travel" between different states of your app.

By default, it will act exactly like a normal Store. You can Time Travel through the states of your app by dispatching your own DevToolsActions, or by including one of the following Dev Tools UI packages for Flutter or web.

For developers, this class acts as your core building block for creating your own implementation of a Dev Tools UI.

Example

First, we'll create a normal Store, to show the drop-in replacement between Production builds and Dev builds.

int addOneReducer(int state, action) => state + 1;

// For production mode, this is how you should create your store.
final store = Store(addReducer);

// In Dev Mode, if you want to hook up to Time-Traveling Dev Tools,
// create a `DevToolsStore` instead!
//
// It will act exactly like your normal Store, but give you super powers
// to travel back and forth in time throughout your app States!
final store = DevToolsStore(addReducer);

Constructors

DevToolsStore(Reducer<S> reducer, {required S initialState, List<Middleware<S>> middleware = const [], bool syncStream = false, bool distinct = false})

Properties

devToolsState DevToolsState<S>
no setter
hashCode int
The hash code for this object.
no setterinherited
onChange Stream<S>
A stream that emits the current state when it changes.
no setter
reducer ↔ Reducer<S>
The Reducer for your Store. Allows you to get the current reducer or replace it with a new one if need be.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → S
Returns the current state of the app
no setter

Methods

dispatch(dynamic action) → dynamic
Runs the action through all provided Middleware, then applies an action to the state using the given Reducer. Please note: Middleware can intercept actions, and can modify actions or stop them from passing through to the reducer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
teardown() Future
Closes down the Store so it will no longer be operational. Only use this if you want to destroy the Store while your app is running. Do not use this method as a way to stop listening to onChange state changes. For that purpose, view the onChange documentation.
toString() String
A string representation of this object.
inherited

Operators

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