NullStreamSink<T>.error constructor

NullStreamSink<T>.error(dynamic error, [ StackTrace stackTrace ])

Creates a null sink whose done future emits error.

Note that this error will not be considered uncaught.

Implementation

NullStreamSink.error(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((_) {});