Skip to content

Instantly share code, notes, and snippets.

@reberthkss
Last active February 3, 2022 16:42
Show Gist options
  • Save reberthkss/337c4ee4aea4cf64a909bcc86e0645d9 to your computer and use it in GitHub Desktop.
Save reberthkss/337c4ee4aea4cf64a909bcc86e0645d9 to your computer and use it in GitHub Desktop.
data class TodoDetail (
val title: String,
val description: String
)
class TodoDetailViewModel: ViewModel() {
private val _state = MutableLiveData<String>()
val state: LiveData<String>
get() = _state
private val _detailError = MutableLiveData<Throwable>()
val todoDetailError: LiveData<Throwable>
get() = _detailError
private val _todoSuccessData = MutableLiveData<TodoDetail>()
val todoSuccessData: LiveData<TodoDetail>
get() = _todoSuccessData
companion object {
const val SUCCESS = "success"
const val ERROR = "loading"
const val LOADING = "error"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment