NullStreamSink<T>.error constructor

NullStreamSink<T>.error(
  1. Object error, [
  2. StackTrace? stackTrace
])

Creates a null sink whose done future emits error.

Note that this error will not be considered uncaught.

Implementation

NullStreamSink.error(Object error, [StackTrace? stackTrace])
    : done = Future.error(error, stackTrace)
        // Don't top-level the error. This gives the user a change to call
        // [close] or [done], and matches the behavior of a remote endpoint
        // experiencing an error.
        ..catchError((_) {});