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

Side by Side Diff: sdk/lib/async/stream_controller.dart

Issue 1177343004: Add Stream.empty. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add test, fix impl. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 // ------------------------------------------------------------------- 7 // -------------------------------------------------------------------
8 // Controller for creating and adding events to a stream. 8 // Controller for creating and adding events to a stream.
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 */ 169 */
170 bool get isPaused; 170 bool get isPaused;
171 171
172 /** Whether there is a subscriber on the [Stream]. */ 172 /** Whether there is a subscriber on the [Stream]. */
173 bool get hasListener; 173 bool get hasListener;
174 174
175 /** 175 /**
176 * Send or enqueue an error event. 176 * Send or enqueue an error event.
177 * 177 *
178 * If [error] is `null`, it is replaced by a [NullThrownError]. 178 * If [error] is `null`, it is replaced by a [NullThrownError].
179 *
180 * Also allows an objection stack trace object, on top of what [EventSink]
181 * allows.
182 */ 179 */
183 void addError(Object error, [StackTrace stackTrace]); 180 void addError(Object error, [StackTrace stackTrace]);
184 181
185 /** 182 /**
186 * Receives events from [source] and puts them into this controller's stream. 183 * Receives events from [source] and puts them into this controller's stream.
187 * 184 *
188 * Returns a future which completes when the source stream is done. 185 * Returns a future which completes when the source stream is done.
189 * 186 *
190 * Events must not be added directly to this controller using [add], 187 * Events must not be added directly to this controller using [add],
191 * [addError], [close] or [addStream], until the returned future 188 * [addError], [close] or [addStream], until the returned future
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 _StreamControllerAddStreamState(_StreamController controller, 899 _StreamControllerAddStreamState(_StreamController controller,
903 this.varData, 900 this.varData,
904 Stream source, 901 Stream source,
905 bool cancelOnError) 902 bool cancelOnError)
906 : super(controller, source, cancelOnError) { 903 : super(controller, source, cancelOnError) {
907 if (controller.isPaused) { 904 if (controller.isPaused) {
908 addSubscription.pause(); 905 addSubscription.pause();
909 } 906 }
910 } 907 }
911 } 908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698