UndoRedoController class

Controller for managing undo/redo operations.

Usage:

final undoController = UndoRedoController();

CodeForge(
  controller: controller,
  undoController: undoController,
)

// Undo last operation
undoController.undo();

// Redo last undone operation
undoController.redo();
Inheritance

Constructors

UndoRedoController({int maxStackSize = 1000, bool groupEdits = true})

Properties

canRedo → bool
Whether redo is available
no setter
canUndo → bool
Whether undo is available
no setter
groupEdits → bool
Whether to group rapid sequential edits into single operations
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isUndoRedoInProgress → bool
Check if an undo/redo operation is currently being applied
no setter
maxStackSize → int
Maximum number of operations to keep in the undo stack
final
redoStack → List<EditOperation>
final
redoStackSize → int
Number of operations in the redo stack
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
undoStack → List<EditOperation>
final
undoStackSize → int
Number of operations in the undo stack
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
beginCompoundOperation() → CompoundOperationHandle
Begin a compound operation that should be undone as a single unit. Call endCompoundOperation when done.
clear() → void
Clear all undo/redo history
dispose() → void
Discards any resources used by the object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
recordEdit(EditOperation operation) → void
Record an edit operation. Called by the controller when text changes.
redo() → bool
Redo the last undone operation
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setApplyEditCallback(void callback(EditOperation operation)) → void
Set the callback to apply edit operations
toString() → String
A string representation of this object.
inherited
undo() → bool
Undo the last operation

Operators

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