runInComputeIsolateStream<Q, P> method
On web, runs the streaming task on the main thread
Implementation
Stream<P> runInComputeIsolateStream<Q, P>(
StreamComputeTask<Q, P> task,
Q argument,
) async* {
await ready;
final controller = StreamController<P>();
try {
final result = task(argument, controller.add);
if (result is Future) {
await result;
}
await controller.close();
} catch (e, stackTrace) {
controller.addError(e, stackTrace);
await controller.close();
}
yield* controller.stream;
}