0

In Dart, there's a handy followedBy method for Lists:

[1, 2].followedBy([3, 4]) // [1, 2, 3, 4]

Is there anything like that for Streams?

I'm looking for something like this:

Stream.fromIterable([1, 2, 3]).followedBy(otherStream);

I already looked at the async package, but StreamZip, StreamGroup and StreamQueue don't seem to be what I want.

Marcel
  • 8,831
  • 4
  • 39
  • 50
  • https://stackoverflow.com/questions/36571924/how-can-i-merge-multiple-streams-into-a-higher-level-stream/36574707 maybe? – aioobe Jun 09 '19 at 18:59
  • Already seen that, but they always combine the latest two elements of the streams. What I want to do is to first use up all the elements of the first stream/list and only then using those of the second stream. – Marcel Jun 09 '19 at 19:01

1 Answers1

0

There is probably something more efficient, but this will work.

Stream<int> streams() async* {
   yield* stream1();
   yield* stream2();
}
Kevin Moore
  • 5,921
  • 2
  • 29
  • 43