Skip to content

Instantly share code, notes, and snippets.

@Farhandroid
Last active March 3, 2022 11:46
Show Gist options
  • Select an option

  • Save Farhandroid/29fcdcfbbaf5f83d8ec97b60aa68b6b1 to your computer and use it in GitHub Desktop.

Select an option

Save Farhandroid/29fcdcfbbaf5f83d8ec97b60aa68b6b1 to your computer and use it in GitHub Desktop.
AppViewModel
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