UndoManager<State> class final

Undo/redo command journal with optional transactional grouping.

Constructors

UndoManager({required UndoCommandDecoder<State> decodeCommand, int maxEntries = 100})
UndoManager.fromJournal({required Map<String, Object?> journal, required UndoCommandDecoder<State> decodeCommand, int maxEntries = 100})
Builds a manager from a persisted journal payload.
factory

Properties

canRedo bool
Whether redo can be performed.
no setter
canUndo bool
Whether undo can be performed.
no setter
hashCode int
The hash code for this object.
no setterinherited
maxEntries int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transactionDepth int
Number of active nested transactions.
no setter

Methods

beginTransaction() → void
Begins a nested command transaction.
clear() → void
Clears undo/redo stacks and abandons active transactions.
commitTransaction() → void
Commits the current transaction into one undoable journal entry.
execute({required UndoableCommand<State> command, required State state}) → void
Executes command, records it for undo/redo, and applies it to state.
loadJournal(Map<String, Object?> journal) → void
Restores undo/redo stacks from a journal payload.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redo({required State state}) bool
Redo one command group if possible.
rollbackTransaction(State state) → void
Reverts all state changes from the active transaction.
toJournal() Map<String, Object?>
Serializes undo and redo stacks as a journal payload.
toString() String
A string representation of this object.
inherited
undo({required State state}) bool
Undo one command group if possible.

Operators

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

Constants

schemaVersion → const int