Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
typical user view model
private val userId = MutableLiveData<String>()
val userDetails = userId.switchMap {
val userFullName = {
getFullName(it.firstName, it.lastName)
fun setUserId(userId: String) {
this.userId.value = userId
fun getFullName(firstName: String, lastName: String) = "$firstName $lastName"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment