pipe<NewRunOutput extends Object?, NewCallOptions extends RunnableOptions> method
RunnableSequence<RunInput, NewRunOutput>
pipe<NewRunOutput extends Object?, NewCallOptions extends RunnableOptions>(
- Runnable<
RunOutput, NewCallOptions, NewRunOutput> next
override
Pipes the output of this RunnableSequence into another Runnable.
next
- the Runnable to pipe the output into.
Implementation
@override
RunnableSequence<RunInput, NewRunOutput> pipe<NewRunOutput extends Object?,
NewCallOptions extends RunnableOptions>(
final Runnable<RunOutput, NewCallOptions, NewRunOutput> next,
) {
if (next is RunnableSequence<RunOutput, NewRunOutput>) {
final nextSeq = next as RunnableSequence<RunOutput, NewRunOutput>;
return RunnableSequence(
first: first,
middle: [...middle, last, nextSeq.first, ...nextSeq.middle],
last: nextSeq.last,
);
} else {
return RunnableSequence(
first: first,
middle: [...middle, last],
last: next,
);
}
}