How can I prevent LaunchedEffect from cancelling an ongoing animation when StateFlow updates rapidly?
I am developing an educational Android application using Kotlin and Jetpack Compose. My application displays mathematical solutions step by step using animations. When a user taps the Next Step button multiple times quickly, the currently running animation gets cancelled, and some intermediate steps are skipped. I want every button press to be processed sequentially, regardless of how quickly the user taps. class StepViewModel : ViewModel() { private val _currentStep = MutableStateFlow(0) val currentStep = _currentStep.asStateFlow() fun nextStep() { _currentStep.value++ } } @Composable fun Ste
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.