Hey I am working on Kotlin flow. I am working in ViewPager2 with Paging 3 Library. I am getting some bug which caused indexing issue in ViewPager2. Someone suggested me use lifecycleScope.launchWhenCreated
but it not working correctly. According to this answer The core issue is that are starting collection on Paging before ViewPager is ready to start binding the items. I tried this solution, but it didn't work well. I want to dig deeply, what the issue of this logic. I added my project link as well Github
lifecycleScope.launchWhenCreated {
viewModel.dataList.collectLatest {
adapter.submitData(it)
}
}