ubu
06/11/2020, 4:23 PMvalue
in StateFlow<Map<Id, T>>
, so that current subscriber does not a receive this update? I have a particular use case from UI programming.
Suppose that this T
is String
. We have a list of texts, that is rendered first in a text editor. This text is then edited by our user and we receive onTextChanged(id, text)
event. We now need to sync this text change with our state: map[id] = text
, but we do not need to render this state again, because UI already has it.
Or maybe there is no way to resolve this problem with StateFlow
?zak.taccardi
06/11/2020, 4:24 PMubu
06/11/2020, 4:25 PMzak.taccardi
06/11/2020, 4:27 PMStateFlow<String>
for EditText
, and let the EditText
itself be the source of truth. If the ViewModel
needs to update the EditText
, then it should emit these updates as a “side effect”ubu
06/11/2020, 4:36 PMZach Klippenstein (he/him) [MOD]
06/11/2020, 4:50 PMubu
06/11/2020, 5:31 PMZach Klippenstein (he/him) [MOD]
06/11/2020, 5:44 PMEditable.replace
instead of setText
to update the text.zak.taccardi
06/11/2020, 5:45 PMZach Klippenstein (he/him) [MOD]
06/11/2020, 6:02 PM