dart-lang / stream_transform

Dart utility methods to create StreamTransfomer instances to manipulate Streams

Home Page:https://pub.dev/packages/stream_transform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement a `combineLatest` transform

natebosch opened this issue · comments

I'd expect usage to look like this:

firstStream.transform(combineLatest(secondStream, (a, b) => a + b));

I'd expect us to not pass null to the combine in case one of the streams hasn't emitted yet - to get that behavior you'd could use a startWith to force an "immediate" start for one or both streams.

Open question on the signature - should the combine callback allow a FutureOr return?

If we allow it - what sort of ordering guarantees should we give?

I think we should allow FutureOr, and we should use the same subscription pausing approach as asyncMap in the core stream implementation to give the ordering guarantees