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

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

Issue 2822173002: Warn when adding something to a closed sink and improve documentation (Closed)
Patch Set: Improve documentation (issue 29122). Created 3 years, 8 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 1f15703dd2853843a962623a709947828c1301e7..06697d35d9b7c9f906e9ea994275a3bcfe9d9e3e 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -235,13 +235,38 @@ abstract class StreamController<T> implements StreamSink<T> {
bool get hasListener;
/**
- * Send or enqueue an error event.
+ * Sends a data [event].
+ *
+ * Listeners receive this event at a later microtask. This behavior can be
Lasse Reichstein Nielsen 2017/04/26 08:26:19 at -> in (or as). A microtask has a duration, it'
floitsch 2017/05/01 16:46:25 Done.
+ * overridden by using `sync` controllers. Note, however, that sync
Lasse Reichstein Nielsen 2017/04/26 08:26:19 Overridden means something else (you override a me
floitsch 2017/05/01 16:46:25 * Note that a synchronous controller (created by p
+ * controllers have to satisfy the preconditions mentioned in the
+ * documentation of the constructors.
+ */
+ void add(T event);
+
+ /**
+ * Sends or enqueues an error event.
*
* If [error] is `null`, it is replaced by a [NullThrownError].
+ *
+ * Listeners receive this event at a later microtask. This behavior can be
+ * overridden by using `sync` controllers. Note, however, that sync
+ * controllers have to satisfy the preconditions mentioned in the
+ * documentation of the constructors.
*/
void addError(Object error, [StackTrace stackTrace]);
/**
+ * Closes the stream.
+ *
+ * Listeners receive the done event at a later microtask. This behavior can be
+ * overridden by using `sync` controllers. Note, however, that sync
+ * controllers have to satisfy the preconditions mentioned in the
+ * documentation of the constructors.
+ */
+ Future close();
+
+ /**
* Receives events from [source] and puts them into this controller's stream.
*
* Returns a future which completes when the source stream is done.

Powered by Google App Engine
This is Rietveld 408576698