Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Created May 22, 2020 12:56
Show Gist options
  • Save PatilShreyas/8ba283653a32596b73abcaf11fb5db1c to your computer and use it in GitHub Desktop.
Save PatilShreyas/8ba283653a32596b73abcaf11fb5db1c to your computer and use it in GitHub Desktop.
@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