Chromium Code Reviews| Index: lib/src/concatenate_streams.dart |
| diff --git a/lib/src/concatenate_streams.dart b/lib/src/concatenate_streams.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d910be0f1b8bfabe72201be8aeeb81732fcbec3e |
| --- /dev/null |
| +++ b/lib/src/concatenate_streams.dart |
| @@ -0,0 +1,19 @@ |
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +import "dart:async"; |
| + |
| +/// Concatenates streams. |
| +/// |
| +/// The events of each stream in [streams] are emitted, one stream at a time |
| +/// in iteration order. When the final stream in [streams] has been processed, |
| +/// the returned stream closes. |
| +/// |
| +/// If the listener on the concatenated stream cancels early, later streams are |
| +/// not listened to at all. |
|
nweiz
2016/03/01 02:10:03
It may be worth mentioning that an iterator may be
Lasse Reichstein Nielsen
2016/03/01 16:51:16
Good point.
|
| +Stream concatenateStreams(Iterable<Stream> streams) async* { |
|
nweiz
2016/03/01 02:10:03
I can buy having fatal errors in scan, because the
Lasse Reichstein Nielsen
2016/03/01 16:51:16
This will forward both value and error events to t
nweiz
2016/03/08 23:57:34
Oh, interesting. I was under the impression that a
|
| + for (var stream in streams) { |
| + yield* stream; |
| + } |
| +} |