Skip to content

Instantly share code, notes, and snippets.

@aleweichandt
Created August 16, 2021 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aleweichandt/fdb6b8914d130d15b149175a7372aea0 to your computer and use it in GitHub Desktop.
Save aleweichandt/fdb6b8914d130d15b149175a7372aea0 to your computer and use it in GitHub Desktop.
Loading Spinner
viewModelScope.launch {
getAllTodosUseCase(force)
.onStart { _refreshing.value = true }
.onCompletion { _refreshing.value = false }
.collect { response ->
(response as? Result.Success)?.let { _todos.value = it.result }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment