Last active
July 20, 2021 18:26
-
-
Save mattmook/329f745dc02439e3fde857aae4f4a17a to your computer and use it in GitHub Desktop.
The state of MVI on Android - Orbit - PostListFragment
This file contains hidden or 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
lifecycleScope.launch { | |
// See https://medium.com/androiddevelopers/a-safer-way-to-collect-flows-from-android-uis-23080b1f8bda | |
lifecycleOwner.lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) { | |
launch { viewModel.container.stateFlow.collect(::reduce) | |
launch { viewModel.container.sideEffectFlow.collect(::sideEffect) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment