https://kotlinlang.org logo
Title
d

David Glasser

08/21/2019, 5:22 PM
I have a Flow that produces a stream of values. I want to take that stream and launch a coroutine for each emitted function inside Dispatchers.IO (or something like that). I believe I don't want
.flowOn(<http://Dispatchers.IO|Dispatchers.IO>)
for this — that's the opposite of what I want as it affects where the emission happens. Do I just want to do launch with context inside collect?
someFlow().map { ... }.filter{ ... }.collect { x ->
  launch(<http://Dispatchers.IO|Dispatchers.IO>) { doSomethingBlockingWith(x) }
}
Like this?
d

Dominaezzz

08/21/2019, 6:53 PM
flatMapMarge
?
d

David Glasser

08/21/2019, 7:00 PM
Isn't that for if I'm returning new Flows? I'm not.
d

Dominaezzz

08/21/2019, 7:01 PM
Oh. Oops.