| 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 /** |
| 6 * Help for combining multiple streams into a single stream. |
| 7 * |
| 8 * This API is also available as part of the |
| 9 * [sequence_zip](#sequence_zip) library. |
| 10 */ |
| 5 library stream_zip; | 11 library stream_zip; |
| 6 | 12 |
| 7 import "dart:async"; | 13 import "dart:async"; |
| 8 | 14 |
| 9 /** | 15 /** |
| 10 * A stream that combines the values of other streams. | 16 * A stream that combines the values of other streams. |
| 11 */ | 17 */ |
| 12 class StreamZip extends Stream<List> { | 18 class StreamZip extends Stream<List> { |
| 13 final Iterable<Stream> _streams; | 19 final Iterable<Stream> _streams; |
| 14 StreamZip(Iterable<Stream> streams) : _streams = streams; | 20 StreamZip(Iterable<Stream> streams) : _streams = streams; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 113 |
| 108 if (subscriptions.isEmpty) { | 114 if (subscriptions.isEmpty) { |
| 109 controller.close(); | 115 controller.close(); |
| 110 } | 116 } |
| 111 return controller.stream.listen(onData, | 117 return controller.stream.listen(onData, |
| 112 onError: onError, | 118 onError: onError, |
| 113 onDone: onDone, | 119 onDone: onDone, |
| 114 cancelOnError: cancelOnError); | 120 cancelOnError: cancelOnError); |
| 115 } | 121 } |
| 116 } | 122 } |
| OLD | NEW |