Hi everyone! I want to be able to listen to change...
# announcements
a
Hi everyone! I want to be able to listen to changes on a variable and be able to publish new value to this variable. I’m wondering what would be the best thing to use without relying on RxJava (to use Subject) I’m torn between LiveData and ConflatedBroadcastChannel, any idea what the best one is?
¯\_(ツ)_/¯
a
The
StateFlow
added to coroutines 1.3.6 sounds relevant here - if you can push the variable updates to a
MutableStateFlow
(or just use a
MutableStateFlow
as the variable) then you can simply collect the flow to receive updates (similar to subscribing to a
ConflatedBroadcastChannel
)
a
@Joel This does sound like the best basic way to support, I’ll look into it! @araqnid I heard about it when looking up Flow but I had no idea they actually published a first version!