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

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

Issue 2213193004: Revert "Return futures on Stream.cancel when possible." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « CHANGELOG.md ('k') | sdk/lib/async/stream_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream.dart
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index f4abf9aac9c2cda45b9b6da83c06c4f434724620..7661d9ffe99978261371223a41a66b8f9833d8a8 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -232,7 +232,6 @@ abstract class Stream<T> {
onCancel: () {
if (timer != null) timer.cancel();
timer = null;
- return Future._nullFuture;
});
return controller.stream;
}
@@ -442,7 +441,7 @@ abstract class Stream<T> {
onListen: onListen,
onPause: () { subscription.pause(); },
onResume: () { subscription.resume(); },
- onCancel: () => subscription.cancel(),
+ onCancel: () { subscription.cancel(); },
sync: true
);
}
@@ -500,7 +499,7 @@ abstract class Stream<T> {
onListen: onListen,
onPause: () { subscription.pause(); },
onResume: () { subscription.resume(); },
- onCancel: () => subscription.cancel(),
+ onCancel: () { subscription.cancel(); },
sync: true
);
}
@@ -1408,10 +1407,7 @@ abstract class StreamSubscription<T> {
* the subscription is canceled.
*
* Returns a future that is completed once the stream has finished
- * its cleanup.
- *
- * For historical reasons, may also return `null` if no cleanup was necessary.
- * Returning `null` is deprecated and should be avoided.
+ * its cleanup. May also return `null` if no cleanup was necessary.
*
* 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
@@ -1715,7 +1711,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);
* });
« no previous file with comments | « CHANGELOG.md ('k') | sdk/lib/async/stream_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698