[Logical Issue] Unreachable code for collecting flow CastVoteActivity.kt
Describe the bug :
With reference to the code from CastVoteActivity.kt: Line:186 to Line:211 is unreachable as we cannot collect multiple flows inside a single lifecycle coroutine scope. Calling collect on a Flow suspends the coroutine until the Flow is complete. For a MutableStateFlow, it will only be complete when it's cancelled. So usually, doing so will execute only the first flow and program never reaches to next flow.
Expected Behaviour :
All the flows should be collected. For this we have to use repeatOnLifecycle(Lifecycle.State.STARTED) and inside this block we have to collect all the flows.
Steps to reproduce it :
LogCat for the issue :
Smartphone Info :
Device | Redmi Note 8 |
Android Version | Android 11 |
Would you like to work on the issue?
I have fixed this issue and attached a PR already. @ABHI165 @hackeramitkumar Kindly review this.