I’m trying to make my methods reactive to update the view in Compose. How to do it properly?
interface Foo{
val a: Int
fun bar(): Int
fun foo(): MutableStateFlow<Int> = MutableStateFlow(bar() * a)
}
//@Composable
val foo by fooImpl.foo().collectAsState()
P.S. Currently I made a hack: empty usage a variable a
participated in calculations. But it’s not good.
val a = fooImpl.collectAsState()
a