Last active
November 25, 2021 08:10
-
-
Save satadii11/890f2ec7b7cab5715e4f72ed2902e9b4 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 MainViewModel : ViewModel() { | |
private val _count = MutableStateFlow(0) | |
val count get() = _count.asStateFlow() | |
init { | |
_count.value = 0 | |
} | |
fun increase() { | |
_count.value = _count.value.inc() | |
} | |
fun decrease() { | |
_count.value = _count.value.dec() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment