CommandHistory<T extends JState> class

Manages a stack of undoable commands.

This is a more flexible alternative to UndoRedoMixin for cases where you need custom undo/redo logic per command.

Constructors

CommandHistory({int maxSize = 50})

Properties

canRedo → bool
no setter
canUndo → bool
no setter
hashCode → int
The hash code for this object.
no setterinherited
maxSize → int
final
redoStackSize → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
undoStackSize → int
no setter

Methods

clear() → void
Clears all history.
execute(T currentState, UndoableCommand<T> command) → T
Executes a command and adds it to history only if its state changes. A throwing command leaves both stacks untouched. Commands must return new immutable states; external side effects cannot be rolled back here.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redo(T currentState) → T?
Redoes the last undone command.
toString() → String
A string representation of this object.
inherited
undo(T currentState) → T?
Undoes the last command.

Operators

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