FR: Stream.merge() #9778
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-obsolete
Closed as the reported issue is no longer relevant
core-2
library-async
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
dart:async should have an easy way to combine multiple streams into one.
Example implementation which supports pause/resume.
Stream merge(List<Stream> streams) {
int _open = streams.length;
var c = new StreamController();
for (var stream in streams) {
stream.listen(c.add)
..onError(c.addError)
..onDone(() {
if (--_open == 0) {
c.close();
}
});
}
return c.stream;
}
The text was updated successfully, but these errors were encountered: