I'm really confused about `.observeAsState` . In m...
# compose
n
I'm really confused about
.observeAsState
. In my ViewModel I have this:
Copy code
val dynamicCallSenderCode = MutableLiveData(0)

     fun onSenderChanged (){
        dynamicCallSenderCode.value = broadcastReceivers.notifyCallSenderCode(context)
    }
What I want to do is observe the broadcast receiver changes from my HomePage but I can't use
.observeAsState
with a function. How could I pass these changes live to my Composable?
i
What exactly do you mean? Seems like you'd be able to do
val senderCode = viewModel.dynamicCallSenderCode.observeAsState().value
and that would recompose anytime the value changes
👍 1