UndoableIntent<T extends JState> class abstract

Intent that supports undo/redo operations.

Use this as a base for intents that should be undoable.

Example:

class IncrementIntent extends UndoableIntent<CounterState> {
  @override
  Future<void> onInvoke() async {
    performUndoableUpdate((state) => state.copyWith(
      counter: state.counter + 1,
    ));
  }
}
Inheritance
Mixed-in types

Constructors

UndoableIntent()

Properties

controller → JController<T>
The controller bound by the most recent invocation.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isCancelled → bool
Whether cancellation was requested for the current execution.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → T
Provides easy access to the current state managed by the controller.
no setterinherited

Methods

cancel() → void
Requests cooperative cancellation of the execution in progress.
inherited
emitAndWaitSideEffect<V>(JEffect<V> effect) → Future<V>
Emits a UI side effect and waits for a result.
inherited
emitSideEffect(JEffect effect) → void
Emits a one-time UI side effect from this intent.
inherited
invoke(JController<T> controller) → Future<void>
Wires the controller before executing the logic. Not overridable; override onInvoke instead. An instance can be reused after completion, but overlapping invocations fail with StateError before rebinding it. Invoking against a disposed controller also fails with StateError.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onInvoke() → Future<void>
Contains the core logic of the intent.
inherited
performUndoableUpdate(T reducer(T state)) → void
Performs an undoable state update.
run(JController<T> controller) → Future<void>
Executes the intent. Not overridable; override onInvoke instead.
inherited
toString() → String
A string representation of this object.
inherited
update(T reducer(T state)) → void
Updates the controller's state using the provided reducer function.
inherited

Operators

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