Index: sdk/lib/async/stream.dart |
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart |
index 7661d9ffe99978261371223a41a66b8f9833d8a8..77fe7e9b2238ed09b2df973529c76984f894450a 100644 |
--- a/sdk/lib/async/stream.dart |
+++ b/sdk/lib/async/stream.dart |
@@ -232,6 +232,7 @@ abstract class Stream<T> { |
onCancel: () { |
if (timer != null) timer.cancel(); |
timer = null; |
+ return new Future.value(null); |
Lasse Reichstein Nielsen
2016/08/01 15:23:26
We have `Future._nullFuture` as a reusable null-va
floitsch
2016/08/01 21:00:37
Done.
|
}); |
return controller.stream; |
} |
@@ -441,7 +442,7 @@ abstract class Stream<T> { |
onListen: onListen, |
onPause: () { subscription.pause(); }, |
onResume: () { subscription.resume(); }, |
- onCancel: () { subscription.cancel(); }, |
+ onCancel: () => subscription.cancel(), |
sync: true |
); |
} |
@@ -499,7 +500,7 @@ abstract class Stream<T> { |
onListen: onListen, |
onPause: () { subscription.pause(); }, |
onResume: () { subscription.resume(); }, |
- onCancel: () { subscription.cancel(); }, |
+ onCancel: () => subscription.cancel(), |
sync: true |
); |
} |
@@ -1407,7 +1408,10 @@ abstract class StreamSubscription<T> { |
* the subscription is canceled. |
* |
* Returns a future that is completed once the stream has finished |
- * its cleanup. May also return `null` if no cleanup was necessary. |
+ * its cleanup. |
+ * |
+ * For historical reasons, may also return `null` if no cleanup was necessary. |
+ * Returning `null` is deprecated and should be avoided. |
* |
* Typically, futures are returned when the stream needs to release resources. |
* For example, a stream might need to close an open file (as an asynchronous |
@@ -1711,7 +1715,7 @@ abstract class StreamTransformer<S, T> { |
* }, |
* onPause: () { subscription.pause(); }, |
* onResume: () { subscription.resume(); }, |
- * onCancel: () { subscription.cancel(); }, |
+ * onCancel: () => subscription.cancel(), |
* sync: true); |
* return controller.stream.listen(null); |
* }); |