CLOVIS
12/17/2020, 10:01 PMwasyl
12/17/2020, 10:09 PMwhy flatMapMerge/flatMapConcat are not recommendedWho says they’re not recommended? 🤔 Perhaps they meant that they’re often not exactly what you want: if you use
flatMapMerge, then all of the flows you emitted are active at the same time, and their emissions are merged.
That is if you have fn(x) = flowOf(x1, x2, x3, …) and do flow.flatMapMerge { fn(it) } then if flow emits a, b, c, d, e then after flat map you’l be getting a1, b1, a2, c1, c2, b2, a3, b3 etc. Previously emitted flows don’t get cancelledwasyl
12/17/2020, 10:10 PMflatMapConcat, the all the flows you emit wait until the previous one finishes.wasyl
12/17/2020, 10:11 PMflatMapLatest, because you’d not be interested in items emitted from flows created for previous value than the latest