streamFromInputStream method

  1. @override
Stream<RunOutput> streamFromInputStream(
  1. Stream<RunInput> inputStream, {
  2. RunnableOptions? options,
})
override

Streams the output of invoking the Runnable on the given inputStream.

  • inputStream - the input stream to invoke the Runnable on.
  • options - the options to use when invoking the Runnable.

Implementation

@override
Stream<RunOutput> streamFromInputStream(
  final Stream<RunInput> inputStream, {
  final RunnableOptions? options,
}) async* {
  Stream<Object?> nextStepStream;
  try {
    nextStepStream = first.streamFromInputStream(
      inputStream,
      options: first.getCompatibleOptions(options),
    );
  } on TypeError catch (e) {
    _throwInvalidInputTypeStream(e, first);
  }

  for (final step in middle) {
    try {
      nextStepStream = step.streamFromInputStream(
        nextStepStream,
        options: step.getCompatibleOptions(options),
      );
    } on TypeError catch (e) {
      _throwInvalidInputTypeStream(e, step);
    }
  }

  try {
    yield* last.streamFromInputStream(
      nextStepStream,
      options: last.getCompatibleOptions(options),
    );
  } on TypeError catch (e) {
    _throwInvalidInputTypeStream(e, last);
  }
}