StepExecutor class

Executes individual workflow steps with checkpoint/resume semantics.

The execution loop for each step:

  1. Check CheckpointStore for existing COMPLETED checkpoint -> skip if found
  2. Record INTENT checkpoint
  3. Execute the step action
  4. Record COMPLETED checkpoint with output
  5. On exception: record FAILED checkpoint

Constructors

StepExecutor({required CheckpointStore store, required String workflowExecutionId, RetryExecutor? retryExecutor, Future<void> delayFn(Duration delay)?, StepNameMismatchWarning? onStepNameMismatch})
Creates a StepExecutor.

Properties

compensateFunctions Map<String, Future<void> Function(dynamic)>
Registered compensation functions keyed by step name. Each function accepts the step result as a dynamic parameter.
final
compensateResults Map<String, dynamic>
Cached step results for compensation, keyed by step name.
final
delayFn Future<void> Function(Duration delay)?
Injectable delay function for testing (avoids real waits in tests).
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isCancelled bool
Whether this execution has been cancelled.
no setter
onStepNameMismatch StepNameMismatchWarning
Callback invoked when a step name mismatch is detected during replay. This warns that a dynamic step name has changed between the original execution and recovery, which may indicate non-deterministic workflow logic or changed input parameters.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stepIndex int
The current step index.
no setter

Methods

cancel() → void
Marks this execution as cancelled.
executeStep<T>(String name, Future<T> action(), {String serialize(T value)?, T deserialize(String data)?, RetryPolicy retryPolicy = RetryPolicy.none, Future<void> compensate(T result)?}) Future<T>
Executes a single step with checkpoint/resume semantics and retry support.
initialize() Future<void>
Loads existing checkpoints from the store for replay.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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