eygraber
02/01/2023, 4:29 AMFoo
that returns a Bar
and it gets called from Baz
, if Foo
needs to recompose does Baz
recompose?Stylianos Gakis
02/01/2023, 9:08 AMeygraber
02/01/2023, 9:15 AM@Composable
fun Foo(): Bar{
return vm.barFlow().collectAsState().value
}
@Composable
fun Baz() {
val bar = Foo()
// do something with bar
}
Stylianos Gakis
02/01/2023, 9:45 AMFoo
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 Baz
, but that’s a minute detail tbh.