-
-
Save aleweichandt/34ad5f398cbcdc299be3a7fb6db58c6f to your computer and use it in GitHub Desktop.
error handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
viewModelScope.launch { | |
getAllTodosUseCase(force) | |
.onStart { _refreshing.value = true } | |
.onCompletion { _refreshing.value = false } | |
.collect { response -> | |
when (response) { | |
is Result.Success -> _todos.value = response.result | |
is Result.Failure -> _error.value = response.error | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment