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

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

Issue 2917683002: Clean-up of Future documentation and small fix-ups. (Closed)
Patch Set: Created 3 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 */ 623 */
624 Stream<T> handleError(Function onError, {bool test(error)}) { 624 Stream<T> handleError(Function onError, {bool test(error)}) {
625 return new _HandleErrorStream<T>(this, onError, test); 625 return new _HandleErrorStream<T>(this, onError, test);
626 } 626 }
627 627
628 /** 628 /**
629 * Transforms each element of this stream into a sequence of elements. 629 * Transforms each element of this stream into a sequence of elements.
630 * 630 *
631 * Returns a new stream where each element of this stream is replaced 631 * Returns a new stream where each element of this stream is replaced
632 * by zero or more data events. 632 * by zero or more data events.
633 * The event values are proveded as an [Iterable] by a call to [convert] 633 * The event values are provided as an [Iterable] by a call to [convert]
634 * with the element as argument, and the elements of that iterable is 634 * with the element as argument, and the elements of that iterable is
635 * emitted in iteration order. 635 * emitted in iteration order.
636 * If calling [convert] throws, or if iteration of the returned values throws, 636 * If calling [convert] throws, or if the iteration of the returned values
637 * the error is emitted on the returned stream and iteration ends for that 637 * throws, the error is emitted on the returned stream and iteration ends
638 * element of this stream. 638 * for that element of this stream.
639 * 639 *
640 * Error events and the done event of this stream are forwarded directly 640 * Error events and the done event of this stream are forwarded directly
641 * to the returned stream. 641 * to the returned stream.
642 * 642 *
643 * The returned stream is a broadcast stream if this stream is. 643 * The returned stream is a broadcast stream if this stream is.
644 * If a broadcast stream is listened to more than once, each subscription 644 * If a broadcast stream is listened to more than once, each subscription
645 * will individually call `convert` and expand the events. 645 * will individually call `convert` and expand the events.
646 */ 646 */
647 Stream<S> expand<S>(Iterable<S> convert(T element)) { 647 Stream<S> expand<S>(Iterable<S> convert(T element)) {
648 return new _ExpandStream<T, S>(this, convert); 648 return new _ExpandStream<T, S>(this, convert);
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 /// Must only be used instead of listening to the [values] stream. 2093 /// Must only be used instead of listening to the [values] stream.
2094 /// If the stream has been listened to, this call fails. 2094 /// If the stream has been listened to, this call fails.
2095 /// After calling this method, listening on the [values] stream fails. 2095 /// After calling this method, listening on the [values] stream fails.
2096 Future cancel() { 2096 Future cancel() {
2097 // If values has been listened to, 2097 // If values has been listened to,
2098 // this throws a StateError saying that stream has already been listened to, 2098 // this throws a StateError saying that stream has already been listened to,
2099 // which is a correct error message for this call too. 2099 // which is a correct error message for this call too.
2100 return values.listen(null).cancel(); 2100 return values.listen(null).cancel();
2101 } 2101 }
2102 } 2102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698