@@ -249,13 +249,40 @@ abstract class StreamController<T> implements StreamSink<T> {
249249 /**
250250 * Closes the stream.
251251 *
252- * Listeners receive the done event at a later microtask. This behavior can be
253- * overridden by using `sync` controllers. Note, however, that sync
254- * controllers have to satisfy the preconditions mentioned in the
255- * documentation of the constructors.
252+ * No further events can be added to a closed stream.
253+ *
254+ * The returned future is the same future provided by [done] .
255+ * It is completed when the stream listeners is done sending events,
256+ * This happens either when the done event has been sent,
257+ * or when the subscriber on a single-subscription stream is canceled.
258+ *
259+ * A broadcast stream controller will send the done event
260+ * even if listeners are paused, so some broadcast events may not have been
261+ * received yet when the returned future completes.
262+ *
263+ * If noone listens to a non-broadcast stream,
264+ * or the listener pauses and never resumes,
265+ * the done event will not be sent and this future will never complete.
256266 */
257267 Future close ();
258268
269+ /**
270+ * A future which is completed when the stream controller is done
271+ * sending events.
272+ *
273+ * This happens either when the done event has been sent, or if the
274+ * subscriber on a single-subscription stream is canceled.
275+ *
276+ * A broadcast stream controller will send the done event
277+ * even if listeners are paused, so some broadcast events may not have been
278+ * received yet when the returned future completes.
279+ *
280+ * If there is no listener on a non-broadcast stream,
281+ * or the listener pauses and never resumes,
282+ * the done event will not be sent and this future will never complete.
283+ */
284+ Future get done;
285+
259286 /**
260287 * Receives events from [source] and puts them into this controller's stream.
261288 *
@@ -575,13 +602,6 @@ abstract class _StreamController<T> implements _StreamControllerBase<T> {
575602 return addState.addStreamFuture;
576603 }
577604
578- /**
579- * Returns a future that is completed when the stream is done
580- * processing events.
581- *
582- * This happens either when the done event has been sent, or if the
583- * subscriber of a single-subscription stream is cancelled.
584- */
585605 Future get done => _ensureDoneFuture ();
586606
587607 Future _ensureDoneFuture () {
0 commit comments