setError method

void setError (dynamic error, [ StackTrace stackTrace ])

Completes this to a stream that emits error and then closes.

This is useful when the process of creating the data for the stream fails.

Any one of setSourceStream, setEmpty, and setError may be called at most once. Trying to call any of them again will fail.

Implementation

void setError(error, [StackTrace stackTrace]) {
  setSourceStream(new Stream.fromFuture(new Future.error(error, stackTrace)));
}