onStreamDone<T> method
Race a Stream - waits for completion (done event).
Triggers when the stream completes normally or with an error. Use this to react to stream lifecycle events.
Example:
await XSelect.run<String>((s) => s
..onStream(dataStream, (data) => 'Data: $data')
..onStreamDone(dataStream, () => 'Stream completed')
..onTimeout(Duration(minutes: 5), () => 'Stream timeout')
);
See also:
- onStream - Handle full stream
Implementation
SelectBuilder<R> onStreamDone<T>(
Stream<T> stream, FutureOr<R> Function() body,
{Object? tag, bool Function()? if_}) {
return onFuture<void>(stream.drain(), (_) => body(), tag: tag, if_: if_);
}