Hey - I'm having some struggles thinking through f...
# flow
c
Hey - I'm having some struggles thinking through flowOn() and the final collect operation. flowOn(SomeDispatcher) seems to configure the up-stream pipeline up to the point where teh pipeline element has a coroutine context already. Cool. But how do I configure
collect{}
to run in a particular context? Should I move what was done in a collect() to an onEach{} and then let collect{} just trigger final logging?
a
Hi @christiangruber, according with
collect
documentation (https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/collect.html), the
collect
operator is usually usued with
onEach
to process the emited items, so using it for that pourpose looks to me way to proceed. Hope this helps!
c
Thanks. I got it working.
👍 1