I have a few subcomponents, each which have a state. From the 'parent' component, I want to monitor the state changes of the subcomponents and, if any of them go to an error state, take some action. I was hoping to be able to do a
select
expression in the 'parent' on a set of
StateFlows
from the subcomponents, but I saw
onReceive
isn't directly supported by
StateFlow
. I tried using
produceIn
on the
StateFlow
so I could use
onReceive
, but then I get the most recent state over and over. I looked at using
distinctUntilChanged
on the
StateFlow
, but then saw that has no effect...What should I go with here? I also can't 'miss' a value here, so maybe
StateFlow
is the wrong tool?