Created
May 22, 2020 12:56
-
-
Save PatilShreyas/8ba283653a32596b73abcaf11fb5db1c 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
@ExperimentalCoroutinesApi | |
class MainViewModel : ViewModel() { | |
private val _countState = MutableStateFlow(0) | |
val countState: StateFlow<Int> = _countState | |
fun incrementCount() { | |
_countState.value++ | |
} | |
fun decrementCount() { | |
_countState.value-- | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment