Johnjake Talledo
doAnotherCall()
viewModel.detailsState
emit and collect
private suspend fun collectProductList() = withContext(<http://Dispatchers.IO|Dispatchers.IO>) { viewLifecycleOwner.lifecycleScope.launch { viewModel.detailsState.collectLatest { state -> when (state) { is ItemDetailState.ShowLoader -> binding.progressBar.visible() is ItemDetailState.HideLoader -> binding.progressBar.gone() is ItemDetailState.OnSuccess -> handleSubListSuccess(state.list, state.details) is ItemDetailState.OnFailed -> handleFailure(state.error) } } } launch { doAnotherCall() } }
list size == counter size
Joffrey
A modern programming language that makes developers happier.