Runner class

A Runner can run a Step and its dependencies, caching the results of each step.

A given Step is evaluated at-most once in a given Runner. Hence, if stepA and stepB both depends on stepC, evaluating the result of both stepA and stepB will not run stepC more than once. To run a step more than once, it is necessary to create a new Runner instance.

It can sometimes be useful to override the result of a specific Step. This can be achieved using the override method. When doing so a Step must be overwritten before it is evaluated. It is always safe to override steps before any calls to run.

Overriding a Step causes the step to not be evaluated, and the overriden value to be used instead. This is useful when injecting initial options into an acyclic graph of steps, or when overriding specific components with mocks/fakes in a testing setup.

Annotations
  • @sealed

Constructors

Runner({RunStepWrapper wrapRunStep = _defaultRunStep})
Create a Runner instance with an empty cache.

Properties

hashCode int
The hash code for this object.
no setterinherited
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
override<T, S extends Step<T>>(S step, FutureOr<T> value) → void
Override step with value, ensuring that step evaluates to value when run is called in this Runner.
run<T>(Step<T> step) Future<T>
Evaluate step after evaluating dependencies or re-use cached values.
toString() String
A string representation of this object.
inherited

Operators

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