https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

deviant

07/30/2022, 11:04 AM
hey guys is it possible to use flows with the
select
builder? something like this
Copy code
flow {
 emit(select {
  someFlow1.onCollect()
  someFlow2.onCollect()
 })
}
n

Nick Allen

07/31/2022, 6:27 PM
I can only guess at what you are hoping such code would do. Maybe you are looking for:
Copy code
merge(someFlow1, someFlow2).first()
u

uli

08/02/2022, 9:43 AM
You could convert your flow to channel first
g

gildor

08/02/2022, 10:17 AM
I wouldn't convert to channel without some really good reason
u

uli

08/02/2022, 10:18 AM
True
d

deviant

08/03/2022, 8:28 AM
i just got used to
select
clause so wanted to use it further with flows. well, i guess merge/combine is ok too for my use cases.
4 Views