ubu
01/23/2020, 11:11 AMViewModel
, I tend to use ConflatedBroadcastChannel
(fooChannel
) as some kind of reactive field, which I transform to Flow
(fooFlow
), which I hold also as a field of this ViewModel
when needed, in order to observe it, combine streams, etc. For me, it’s like using BehaviorSubject
from RxJava
. Sometimes I need to access the current value of this channel to perform some fire-and-forget operation . What is then more correct, less error-prone:
fooFlow.take(1).collect { performSomeSuspendableOperation(it) }
or
performSomeSuspendableOperation(fooChannel.value)
Thanks guys!Zach Klippenstein (he/him) [MOD]
01/23/2020, 3:39 PM