Thread
#compose
    Nat Strangerweather

    Nat Strangerweather

    1 year ago
    I'm really confused about
    .observeAsState
    . In my ViewModel I have this:
    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

    Ian Lake

    1 year ago
    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