observe Without Owner
Observe LiveData without particular owner (Activity eg.). Observer is removed when ViewModel is destroyed.
Parameters
callback
Lambda called when new value is dispatched to LiveData
fun <T : Any> DefaultValueLiveData<T>.observeWithoutOwner(callback: (T) -> Unit)
Content copied to clipboard
Observe DefaultValueLiveData without particular owner (Activity eg.). Observer is removed when ViewModel is destroyed.
Parameters
callback
Lambda called when new value is dispatched to LiveData
fun <T : Any> DefaultValueMediatorLiveData<T>.observeWithoutOwner(callback: (T) -> Unit)
Content copied to clipboard
Observe DefaultValueMediatorLiveData without particular owner (Activity eg.). Observer is removed when ViewModel is destroyed.
Parameters
callback
Lambda called when new value is dispatched to LiveData