W3cubDocs

/Dart 2

drain<E> method

Future<E> drain <E>([E futureValue ])

Discards all data on the stream, but signals when it's done or an error occurred.

When subscribing using drain, cancelOnError will be true. This means that the future will complete with the first error on the stream and then cancel the subscription.

In case of a done event the future completes with the given futureValue.

Implementation

Future<E> drain<E>([E futureValue]) =>
    listen(null, cancelOnError: true).asFuture<E>(futureValue);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-async/Stream/drain.html