TimeTravelEnhancer
Time travel enhancer that allows rewinding and replaying actions.
This enhancer keeps a history of all states and allows you to jump to any point in the history.
Example:
final timeTravel = TimeTravelEnhancer<AppState>();
final store = createStore(
reducer,
initialState,
enhancer: timeTravel.enhancer,
);
// Later...
timeTravel.jumpTo(5); // Jump to state at index 5
timeTravel.undo(); // Go back one state
timeTravel.redo(); // Go forward one state
Constructors
Properties
- canRedo → bool
-
Whether we can redo (go forward in history).
no setter
- canUndo → bool
-
Whether we can undo (go back in history).
no setter
- currentIndex → int
-
Returns the current index in the history.
no setter
-
enhancer
→ StoreEnhancer<
S> -
The store enhancer function.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
history
→ List<
S> -
Returns the current history of states.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
jumpTo(
int index) → void - Jump to a specific index in history.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
redo(
) → void - Go forward one state in history.
-
reset(
) → void - Reset history and start fresh.
-
toString(
) → String -
A string representation of this object.
inherited
-
undo(
) → void - Go back one state in history.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited