W3cubDocs

/Dart 2

asFuture<E> method

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

Returns a future that handles the onDone and onError callbacks.

This method overwrites the existing onDone and onError callbacks with new ones that complete the returned future.

In case of an error the subscription will automatically cancel (even when it was listening with cancelOnError set to false).

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

Implementation

Future<E> asFuture<E>([E futureValue]);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-async/StreamSubscription/asFuture.html