Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lifecycleScope.launch {
viewModel.dogImagesFlow.collect {
when (it) {
is ResultWrapper.NetworkError -> {
errorText.append("${it.errorMessage} \n")
...
}
is ResultWrapper.Success<*> -> {
...
showLoading(false)
adapter.submitList(it.value as? List<String>)
}
is ResultWrapper.Loading -> {
...
showLoading(it.isLoading)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment