StreamChannel<T>.withGuarantees constructor

  1. Stream<T> stream,
  2. StreamSink<T> sink,
  3. {bool allowSinkErrors = true}

Creates a new StreamChannel that communicates over stream and sink.

Unlike, 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 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.


factory StreamChannel.withGuarantees(Stream<T> stream, StreamSink<T> sink,
        {bool allowSinkErrors = true}) =>
    GuaranteeChannel(stream, sink, allowSinkErrors: allowSinkErrors);