setError method

void setError(
  1. Object error,
  2. [StackTrace? stackTrace]

Completes this to a closed sink whose StreamSink.done future emits error.

This is useful when the process of loading the sink fails.

Either of setDestinationSink or setError may be called at most once. Trying to call either of them again will fail.


void setError(Object error, [StackTrace? stackTrace]) {
  setDestinationSink(NullStreamSink.error(error, stackTrace));