I have two `Channel`s, and a `StateFlow`. I need a...
# coroutines
r
I have two `Channel`s, and a
StateFlow
. I need a derived
Flow
which can select from either one of the two channels, or both, based on the value of the
StateFlow
. Doing it with a
mapLatest
and a
select
clause generally works, but occasionally one of the channels will have an "undelivered element". I believe its because the select cancellation in
mapLatest
when the
StateFlow
value changes is racing with the
send
to the channel. Is there another approach here that would work?
I ended up refactoring the code to avoid the
Flow
.