StreamChannel<T>.withGuarantees constructor
- Stream<
T> stream, - StreamSink<
T> sink, { - bool allowSinkErrors = true,
Creates a new StreamChannel that communicates over stream
and sink
.
Unlike StreamChannel.new, this enforces the guarantees listed in the StreamChannel documentation. This makes it somewhat less efficient than just wrapping a stream and a sink directly, so StreamChannel.new should be used when the guarantees are provided natively.
If allowSinkErrors
is false
, errors are not allowed to be passed to
sink
. If any are, the connection will close and the error will be
forwarded to sink
.done.
Implementation
factory StreamChannel.withGuarantees(Stream<T> stream, StreamSink<T> sink,
{bool allowSinkErrors = true}) =>
GuaranteeChannel(stream, sink, allowSinkErrors: allowSinkErrors);