Mark
11/29/2020, 9:24 AMadd(item)
and remove(item)
functions to manipulate the state. Suppose we want to expose the state as a Flow<List<Item>>
. Would you:
1. Maintain a private property MutableList<Item>
and set MutableStateFlow<List<Item>>.value = items.toList()
inside add()
and remove()
and expose using asStateFlow()
2. Use an actor
with Add/Remove messages (sealed class) and use that to update a MutableStateFlow
3. Something else?