Hi folks. Question about using SharedFlow: sometim...
# flow
c
Hi folks. Question about using SharedFlow: sometimes I want to apply
filter
or
map
, but these return regular `Flow`s, but I still want to use a SharedFlow. I know I can call
stateIn
or
shareIn
to turn them back into a StateFlow/SharedFlow, but this requires that I pass some arguments, when what I really want is for the same SharedFlow I had before, except with these filters/maps applied. Am I missing something? Is there a better way to map/filter a SharedFlow?
w
What's some example use case you need this for?
e
if your transformations are stateless, then it shouldn't matter how many times the resulting flow is subscribed, even if it's not a "StateFlow". if they're stateful, you should probably declare what dispatcher they run on anyway…
c
Thanks for responding! Sorry I realize my question is more about
StateFlow
specifically, since I have some code which accesses
value
directly. But, as it turns out, when I tried to write some example describing what I’d like to do, I realized that it did not make sense to filter/map a state flow into another state flow. So thanks anyhow!
👍 1