stream method
Streams the output of invoking the Runnable on the given input
.
Implementation
@override
Stream<RunOutput> stream(
RunInput input, {
RunnableOptions? options,
}) async* {
Object? firstError;
for (final runnable in [mainRunnable, ...fallbacks]) {
try {
final stream = runnable.stream(
input,
options: firstError == null
? options
: runnable.getCompatibleOptions(options),
);
await for (final output in stream) {
yield output;
}
return;
} catch (e) {
firstError ??= e;
}
}
throw Exception('All runnables failed. First error: $firstError');
}