-
-
Save saqib-github-commits/1c4932456132df1a23c25617b91a0a6f to your computer and use it in GitHub Desktop.
This file contains 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
class LaunchedEffectTestViewModel : ViewModel() { | |
private var _snackbarCount = MutableStateFlow(1) | |
val snackbarCount: StateFlow<Int> get() = _snackbarCount | |
init { | |
viewModelScope.launch { | |
var displayCount = 1 | |
while (displayCount < 3) { | |
delay(1000L) | |
displayCount += 1 | |
_snackbarCount.value = displayCount | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment