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

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

Issue 301193010: Update documentation for "close". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove spurious future Created 6 years, 7 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
Index: sdk/lib/async/stream_controller.dart
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index 34582ae7a27603b74dcc2e17ccb64f2c1017593b..5a70e943bf1259bd6bd7acfe3c5d8be9c4230ba7 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -382,6 +382,13 @@ abstract class _StreamController<T> implements StreamController<T>,
return addState.addStreamFuture;
}
+ /**
+ * Returns a future that is completed when the stream is done
+ * processing events.
+ *
+ * This happens either when the done event has been sent, or if the
+ * subscriber of a single-subscription stream is cancelled.
+ */
Future get done => _ensureDoneFuture();
Future _ensureDoneFuture() {
@@ -408,15 +415,17 @@ abstract class _StreamController<T> implements StreamController<T>,
}
/**
- * Closes this controller.
+ * Closes this controller and sends a done event on the stream.
*
- * After closing, no further events may be added using [add] or [addError].
+ * The first time a controller is closed, a "done" event is added to its
+ * stream.
*
* You are allowed to close the controller more than once, but only the first
* call has any effect.
*
- * The first time a controller is closed, a "done" event is sent to its
- * stream.
+ * After closing, no further events may be added using [add] or [addError].
+ *
+ * The returned future is completed when the done event has been delivered.
*/
Future close() {
if (isClosed) {

Powered by Google App Engine
This is Rietveld 408576698