Last active
March 3, 2022 11:46
-
-
Save Farhandroid/29fcdcfbbaf5f83d8ec97b60aa68b6b1 to your computer and use it in GitHub Desktop.
AppViewModel
This file contains hidden or 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 AppViewModel : ViewModel() { | |
| private val _titleInputFlow = MutableStateFlow<String>("") | |
| val titleInputFlow: StateFlow<String> get() = _titleInputFlow | |
| fun setTitle(title: String) { | |
| _titleInputFlow.value = title | |
| } | |
| fun resetTitle() { | |
| _titleInputFlow.value = "" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment