flatMapIterable<S> method

Stream<S> flatMapIterable<S>(
  1. Stream<Iterable<S>> mapper(
    1. T value
    ), {
  2. int? maxConcurrent,

Converts each item into a Stream. The Stream must return an Iterable. Then, each item from the Iterable will be emitted one by one.

Use case: you may have an API that returns a list of items, such as a Stream<List


RangeStream(1, 4)
  .flatMapIterable((i) => Stream.fromIterable([[i]]))
  .listen(print); // prints 1, 2, 3, 4


Stream<S> flatMapIterable<S>(Stream<Iterable<S>> Function(T value) mapper,
        {int? maxConcurrent}) =>
    FlatMapStreamTransformer<T, Iterable<S>>(mapper,
            maxConcurrent: maxConcurrent)
        .expand((Iterable<S> iterable) => iterable);