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

tseisel

05/22/2019, 9:03 PM
Does
Flow
have a corresponding
select
clause, and if it doesn't, is it planned ?
o

octylFractal

05/22/2019, 9:24 PM
what would you want to
select
on? I suppose
single
might make sense, but it's still an extension based on
collect
, so
collect
would need to be selectable, but
collect
doesn't really seem like a good idea for it
t

tseisel

05/22/2019, 9:40 PM
I'd like to receive simultaneously from the
ReceiveChannel
of an
actor
and the items emitted by a
Flow
. Should I convert my
Flow
to a
ReceiveChannel
with
Flow.produceIn
in order to use the
onReceive
clause ?
o

octylFractal

05/22/2019, 9:49 PM
that sounds like a better option
I think
select
in general doesn't make sense for Flow -- it's a cold stream, so it won't start until you consume it, but you won't start consuming it until you call
collect
, and if you
select
, you're technically not consuming it, so it will never be started
👍 2
g

gildor

05/22/2019, 11:26 PM
Another option is convert channel yo Flow and use combineLatest operator
👍 1
6 Views