As I understand when some composable "X" uses
value
on some
State<T>
"S", then the Compose runtime automatically recomposes X when S changes. Potentially bypassing recomposing any composables that just forward S to X without calling
value
.
In my app, I have a "container composables" that are responsible for observing streams from a view model and passing the observed values to children composables. In one of the containers I have
StateFlow<List<T>>.collectAsState()
and I pass
State<List<T>>
to children of the container. What should I do, if I want to pass a boolean indicating whether
List<T>
is empty? Can I somehow create a new
State<Boolean>
?
And in general, should I always prefer to pass
State<T>
to composables instead of just
T
?