Last active
November 25, 2021 08:09
-
-
Save satadii11/214477b446252e7895c67368c194109f 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