Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class ListViewModel : ViewModel {
private val _navigateToDetails = MutableLiveData<Event<String>>()
val navigateToDetails : LiveData<Event<String>>
get() = _navigateToDetails
fun userClicksOnButton(itemId: String) {
_navigateToDetails.value = Event(itemId) // Trigger the event by setting a new Event as a new value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment