Chromium Code Reviews| Index: sdk/lib/async/stream_impl.dart |
| diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart |
| index e6de3d7dc38c073531119041c2bbee913ef0cfc0..fd7d7db3a8e5b59d0f9239a8258a77e4a68c5296 100644 |
| --- a/sdk/lib/async/stream_impl.dart |
| +++ b/sdk/lib/async/stream_impl.dart |
| @@ -955,6 +955,19 @@ class _StreamSubscriptionImpl<T> extends _StreamListener<T> |
| if (!_isSubscribed || !isPaused) return; |
| _source._resume(this, false); |
| } |
| + |
| + Future asFuture([var futureValue]) { |
| + _FutureImpl<T> result = new _FutureImpl<T>(); |
| + |
| + // Overwrite the onDone and onError handlers. |
| + onDone(() { result._setValue(futureValue); }); |
| + onError((AsyncError error) { |
| + cancel(); |
|
Anders Johnsen
2013/04/15 09:15:47
Set unsubscribeOnError = true?
Lasse Reichstein Nielsen
2013/04/15 10:19:15
It's final, and if you overwrite onError again, wh
|
| + result._setError(error); |
| + }); |
| + |
| + return result; |
| + } |
| } |
| // Internal helpers. |