Does it make sense to have a `flow` that inside d...
# coroutines
p
Does it make sense to have a
flow
that inside does an
async{}
call? For instance
Copy code
flow<List<Foo>>{
  val list = getFromApi()
  val one = async(<http://Dispatchers.IO|Dispatchers.IO>)
  val two = async(<http://Dispatchers.IO|Dispatchers.IO>)
  val correctList = one.await() + two.await()
  emit(correctList)
}
Or it's better to use async without flow here? That's pseudo because to do
async
I need a
coroutineScope
is there any way to get it from the
flow
?
e
You need a scope to collect the flow. Or a
coroutineScope
to do the
async
calls. I would do the latter if it really doesn't need to be a flow.
p
means? you wouldn't use flow?
👌 1
u
async basically does the same thing as an rx single. just simpler. That’s probably why there is no SingleFlow’
z
It would probably be more idiomatic to just make this a suspend function, so that it’s up to the caller whether to wait for it to finish or run concurrently.
👍 1
☝️ 1