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

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

Issue 2475303002: Revert "Handle the case of Stream.take(0) better." This reverts commit 8cead4090cc0b1184a2ad552003a… (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | sdk/lib/async/stream_pipe.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream.dart
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index f114f8d6bd484ea3382fa52f7a872a8210648036..4f0d9f0e0b428d9bf279d7523b775031989554bf 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -903,23 +903,23 @@ abstract class Stream<T> {
=> listen(null, cancelOnError: true).asFuture/*<E>*/(futureValue);
/**
- * Provides at most the first [count] data events of this stream.
+ * Provides at most the first [n] values of this stream.
*
- * Forwards all events of this stream to the returned stream
- * until [count] data events have been forwarded or this stream ends,
- * then ends the returned stream with a done event.
+ * Forwards the first [n] data events of this stream, and all error
+ * events, to the returned stream, and ends with a done event.
*
- * If this stream produces fewer than [count] data events before it's done,
+ * If this stream produces fewer than [count] values before it's done,
* so will the returned stream.
*
- * Starts listening to this stream when the returned stream is listened to
- * and stops listening when the first [count] data events have been received.
+ * Stops listening to the stream after the first [n] elements have been
+ * received.
*
- * This means that if this is a single-subscription (non-broadcast) streams
- * it cannot be reused after the returned stream has been listened to.
+ * Internally the method cancels its subscription after these elements. This
+ * means that single-subscription (non-broadcast) streams are closed and
+ * cannot be reused after a call to this method.
*
- * If this is a broadcast stream, the returned stream is a broadcast stream.
- * In that case, the events are only counted from the time
+ * The returned stream is a broadcast stream if this stream is.
+ * For a broadcast stream, the events are only counted from the time
* the returned stream is listened to.
*/
Stream<T> take(int count) {
@@ -930,7 +930,7 @@ abstract class Stream<T> {
* Forwards data events while [test] is successful.
*
* The returned stream provides the same events as this stream as long
- * as [test] returns `true` for the event data. The stream is done
+ * as [test] returns [:true:] for the event data. The stream is done
* when either this stream is done, or when this stream first provides
* a value that [test] doesn't accept.
*
« no previous file with comments | « no previous file | sdk/lib/async/stream_pipe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698