| OLD | NEW |
| 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 * Discards all data on the stream, but signals when it's done or an error | 864 * Discards all data on the stream, but signals when it's done or an error |
| 865 * occurred. | 865 * occurred. |
| 866 * | 866 * |
| 867 * When subscribing using [drain], cancelOnError will be true. This means | 867 * When subscribing using [drain], cancelOnError will be true. This means |
| 868 * that the future will complete with the first error on the stream and then | 868 * that the future will complete with the first error on the stream and then |
| 869 * cancel the subscription. | 869 * cancel the subscription. |
| 870 * | 870 * |
| 871 * In case of a `done` event the future completes with the given | 871 * In case of a `done` event the future completes with the given |
| 872 * [futureValue]. | 872 * [futureValue]. |
| 873 */ | 873 */ |
| 874 Future<E> drain<E>([E futureValue]) => listen(null, cancelOnError: true) | 874 Future<E> drain<E>([E futureValue]) => |
| 875 .asFuture<E>(futureValue); | 875 listen(null, cancelOnError: true).asFuture<E>(futureValue); |
| 876 | 876 |
| 877 /** | 877 /** |
| 878 * Provides at most the first [count] data events of this stream. | 878 * Provides at most the first [count] data events of this stream. |
| 879 * | 879 * |
| 880 * Forwards all events of this stream to the returned stream | 880 * Forwards all events of this stream to the returned stream |
| 881 * until [count] data events have been forwarded or this stream ends, | 881 * until [count] data events have been forwarded or this stream ends, |
| 882 * then ends the returned stream with a done event. | 882 * then ends the returned stream with a done event. |
| 883 * | 883 * |
| 884 * If this stream produces fewer than [count] data events before it's done, | 884 * If this stream produces fewer than [count] data events before it's done, |
| 885 * so will the returned stream. | 885 * so will the returned stream. |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 void addError(error, [StackTrace stackTrace]) { | 1792 void addError(error, [StackTrace stackTrace]) { |
| 1793 _sink.addError(error, stackTrace); | 1793 _sink.addError(error, stackTrace); |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 void close() { | 1796 void close() { |
| 1797 _sink.close(); | 1797 _sink.close(); |
| 1798 } | 1798 } |
| 1799 } | 1799 } |
| OLD | NEW |