build<T> method

Step<T> build<T>(
  1. FutureOr<T> runStep(
    1. A valueA,
    2. B valueB
    )
)

Build a step with a single dependency.

This methods requires a runStep function which runs the step, given values from evaluation of dependent steps. The runStep method may be asynchronous. The runStep method will be invoked by Runner.run when the step is evaluated.

The dependent steps which creates valueA and valueB passed to runStep have already be defined when this object was created. See Step.define for how to define steps using this API.

This method returns the Step built by the builder.

Implementation

Step<T> build<T>(FutureOr<T> Function(A valueA, B valueB) runStep) =>
    Step._(_name, (r, wrap) async {
      final a_ = r.run(_a);
      final b_ = r.run(_b);
      await Future.wait([a_, b_]);
      final a = await a_;
      final b = await b_;
      return await wrap(() => runStep(a, b));
    }, [_a, _b]);