Skip to content

Instantly share code, notes, and snippets.

@chenzhang2006
Last active February 18, 2022 22:19
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 chenzhang2006/32150d462f123279d32e1d69a1a8d061 to your computer and use it in GitHub Desktop.
Save chenzhang2006/32150d462f123279d32e1d69a1a8d061 to your computer and use it in GitHub Desktop.
Specify coroutine name at coroutine builder
viewModelScope.launch(CoroutineName("GetFavorites")) {
postsRepository.observeFavorites().collect { favorites ->
viewModelState.update { it.copy(favorites = favorites) }
}
}
// or within your custom coroutine scope
launch(CoroutineName("GetFavorites")) {
postsRepository.observeFavorites().collect { favorites ->
viewModelState.update { it.copy(favorites = favorites) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment