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

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

Issue 1177343004: Add Stream.empty. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove the null future "optimization". Fix some missing type parameters. Created 5 years, 6 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 | « sdk/lib/async/stream_controller.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream_impl.dart
diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
index 3f77294619a6e3d3b1e23f7794fc6b51e8700e95..19bdb699a91f77a9d268a77c4a4a9de164069b64 100644
--- a/sdk/lib/async/stream_impl.dart
+++ b/sdk/lib/async/stream_impl.dart
@@ -1081,3 +1081,15 @@ class _StreamIteratorImpl<T> implements StreamIterator<T> {
_state = _STATE_EXTRA_DONE;
}
}
+
+/** An empty broadcast stream, sending a done event as soon as possible. */
+class _EmptyStream<T> extends Stream<T> {
+ const _EmptyStream() : super._internal();
+ bool get isBroadcast => true;
+ StreamSubscription<T> listen(void onData(T data),
+ {Function onError,
+ void onDone(),
+ bool cancelOnError}) {
+ return new _DoneStreamSubscription<T>(onDone);
+ }
+}
« no previous file with comments | « sdk/lib/async/stream_controller.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698