Chain<Initial, Final> class
A type-safe implementation of Chain of Responsibility pattern that transforms data through a sequence of processing steps.
Key features:
- Type-safe data flow between steps
- Automatic rollback on failure
- Rich error handling and execution control
- Extensible through mixins
Example:
final chain = Chain<RequestData, ResponseData>()
..addStep(ValidationStep())
..addStep(ProcessingStep());
final result = await chain.run(RequestData('test'));
Constructors
Properties
- context → ChainContext
-
Execution context shared between steps
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
history
→ List<
StepState> -
Unmodifiable view of step execution history
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shouldRollbackOnError → bool
-
Whether to rollback completed steps on error
final
Methods
-
addStep<
StepInput, StepOutput> (ChainStep< StepInput, StepOutput> step) → void - Adds a step to the chain
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
printSequence(
) → void - Prints sequence of steps
-
run(
Initial initialData, {StepListener? listener}) → Future< Final> - Runs the chain with given initial data
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited