Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
View observing view state updates
// In your view/fragment
viewLifecycleOwner.lifecycleScope.launch {
viewModel.viewState
.flowWithLifecycle(viewLifecycleOwner.lifecycle, Lifecycle.State.STARTED)
.collect {
// do something with the UI updates
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment