I have two streams, Stream<A>
and Stream<B>
. I have a constructor for a type C
that takes an A
and a B
. How do I merge the two Stream
s into a Stream<C>
?
You can use StreamZip
in package:async
to combine two streams into one stream of pairs, then create the C
objects from that.
import "package:async" show StreamZip;
...
Stream<C> createCs(Stream<A> as, Stream<B> bs) =>
new StreamZip([as, bs]).map((ab) => new C(ab[0], ab[1]));