Sounds like a yes. But you could probably throw some code here to make more clear what you are describing.
e
eygraber
02/01/2023, 9:15 AM
Yeah, quickly threw it out there because I was about to go to sleep đŸ˜…
I'm thinking something like
Copy code
@Composable
fun Foo(): Bar{
return vm.barFlow().collectAsState().value
}
@Composable
fun Baz() {
val bar = Foo()
// do something with bar
}
s
Stylianos Gakis
02/01/2023, 9:45 AM
Yes, Baz will receive the new value from Foo(), and it will recompose.
With that said, composable functions that return something should be lower-case to indicate that. So since your
Foo
returns a value, i should be called
foo
.
Also it may be a good idea to return
State<Bar>
instead of doing the
value
read in the function itself, so that on the call site you can read it as a state and only use it later at the point that it is needed instead of the entire recomposition scope of