I want my ViewModel be the source of truth for wha...
# compose
z
I want my ViewModel be the source of truth for whatever the user entered in a text field. Would this be the correct way or is there a better approach. See thread
a
Copy code
var query by mutableStateOf("")
  private set
will involve less intermediate machinery in practice
(or leave the setter public, up to you)
z
thank you
a
Isn't the MutableStateFlow better if many threads can set _query?
a
No, arguably snapshot state is better there since you can set many snapshot state values atomically
👍 2
In the same transaction