Step<T> class

A Step is a function that may depend on the result of other steps.

A Step has a name, a set of directDependencies, a type T, and an internal function that given the result of all the dependencies can compute a result of type T.

On its own a Step cannot be evaluated. To execute a Step a Runner must be used. A Runner caches the result of steps as they are evaluated. Hence, within a given Runner instance a single Step instance is evaluated at most once.

To evaluate a Step call Runner.run passing in the step. This will evaluate dependencies (if results are not already cached), and evaluate the step passed in.

Do not implement the Step interface, this class is sealed. Instances should be created using the static method define which returns a StepBuilder that can be used to build a step without dependencies or create a StepBuilder1 which can build a step with 1 dependency, or create a StepBuilder2 which can build a step with 2 dependencies, or create StepBuilder3 an so forth until StepBuilder9 which holds 9 dependencies.

If more than 9 dependencies is needed, then StepBuilder.deps can be used to create a StepBuilderN which takes N dependencies. This allows an arbitrary number of dependencies, but consuming the result may require type casting.

Annotations
  • @sealed

Properties

directDependencies Iterable<Step<Object?>>
Direct dependencies of this step.
final
hashCode int
The hash code for this object.
no setterinherited
name String
Name of the step.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

define(String name) StepBuilder
Define a Step using a StepBuilder.