Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TeamViewModel : ViewModel(), CoroutineScope {
- //...Rest of TeamViewModel
- private lateinit var teams: MutableLiveData<List<Team>>
- fun getTeams(): LiveData<List<Team>> {
- if (!::teams.isInitialized) {
- teams = MutableLiveData()
- }
- return teams
- }
- private lateinit var isLoading: MutableLiveData<Boolean>
- fun getIsLoading(): LiveData<Boolean> {
- if (!::isLoading.isInitialized) {
- isLoading = MutableLiveData()
- }
- return isLoading
- }
- private lateinit var showError: MutableLiveData<Boolean>
- fun shouldShowError(): LiveData<Boolean> {
- if (!::showError.isInitialized) {
- showError = MutableLiveData()
- }
- return showError
- }
- //...Rest of TeamViewModel
- }
Add Comment
Please, Sign In to add comment