ExecutionStateMachine class

Valid state transitions for the execution state machine.

Enforces the transition rules from the execution model:

  • pending -> validating, cancelled
  • validating -> running, failed, cancelled
  • running -> waitingReview, waitingApproval, paused, completed, failed, cancelled
  • waitingReview -> running, failed, cancelled
  • waitingApproval -> running, failed, cancelled
  • paused -> running, cancelled
  • failed -> rolledBack
  • completed, cancelled, rolledBack -> (terminal, no transitions)

Constructors

ExecutionStateMachine([ExecutionState initialState = ExecutionState.pending])
Create a state machine starting in the given state.

Properties

currentState → ExecutionState
Get current state.
no setter
hashCode → int
The hash code for this object.
no setterinherited
history → List<StateTransition>
Get transition history.
no setter
isActive → bool
Check if in a running/active state (not terminal, not pending).
no setter
isTerminal → bool
Check if in a terminal state (no further transitions possible).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
validTransitions → List<ExecutionState>
Get valid transitions from current state.
no setter

Methods

canTransitionTo(ExecutionState target) → bool
Check if a transition to the target state is valid.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Reset the state machine to initial state.
toString() → String
A string representation of this object.
inherited
transitionTo(ExecutionState target, {String? reason, Map<String, dynamic>? metadata}) → void
Transition to a new state with validation.

Operators

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