Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: sdk/lib/async/stream.dart

Issue 14237002: Add StreamSubscription.asFuture. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/async/stream.dart
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 7da445168addd87af12387a9a5ce5eab2e39f13c..8c2c2e8fd404b6ca28bfaf7da1aead421a3067fa 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -832,6 +832,20 @@ abstract class StreamSubscription<T> {
* Resume after a pause.
*/
void resume();
+
+ /**
+ * 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 `unsubscribeOnError` set to `false`).
Lasse Reichstein Nielsen 2013/04/15 10:19:15 "This also makes the subscription cancel on any er
floitsch 2013/04/15 12:16:37 If you change the onError handler it won't receive
+ *
+ * In case of a `done` event the future completes with the given
+ * [futureValue].
+ */
+ Future asFuture([var futureValue]);
}

Powered by Google App Engine
This is Rietveld 408576698