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
Adam Powell
01/30/2022, 7:08 PM
var query by mutableStateOf("")
private set
will involve less intermediate machinery in practice
(or leave the setter public, up to you)
z
Zun
01/30/2022, 7:15 PM
thank you
a
Arun Joseph
01/30/2022, 7:52 PM
Isn't the MutableStateFlow better if many threads can set _query?
a
Adam Powell
01/31/2022, 1:54 AM
No, arguably snapshot state is better there since you can set many snapshot state values atomically