Does anyone know of any stream combinator libraries for dart? Things like joining multiple Stream into one Stream, split, combine(Stream, Stream) -> Stream<(A, B)>, etc.
I'm not aware of a stream combinator library, but you could try to use StreamController
to join streams.
Stream join(Stream a, Stream b) {
var sc = new StreamController();
int countDone = 0;
done() {
countDone++;
if (countDone == 2) {
sc.close();
}
}
a.listen((e) => sc.add(e), onDone: done);
b.listen((e) => sc.add(e), onDone: done);
return sc.stream;
}
Warning: untested code.
Check out my library Frappe. It's loosely inspired by Bacon.js, and has a bunch of methods for combining streams.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With