Zoltan Demant
08/06/2022, 8:17 AMStylianos Gakis
08/06/2022, 9:38 AM() -> B
instead and simply invoke this at the level in which you want to read it. And then if you need it as a state I’m pretty sure you can use rememberUpdatedState to turn () -> B
into State<B>
smth like:
@Composable
private fun B(getB: () -> Int) {
val b by rememberUpdatedState(getB())
LogCompositions("B", "b:$b")
}
Do you have some code to share to better understand what you’re trying to do? When you’re saying “I’m creting a class A” do you mean a composable or an actual Class?Zoltan Demant
08/06/2022, 10:11 AMZoltan Demant
08/06/2022, 10:17 AMStylianos Gakis
08/06/2022, 10:26 AMState<T>
seems to be always discouraged, here is a relevant thread which then also points to another thread 😄 https://kotlinlang.slack.com/archives/CJLTWPH7S/p1640293291045100?thread_ts=1640270959.029600&cid=CJLTWPH7S
But as far as doing it automatically for 1759 classes no I don’t know of anything else you can do 😄 Best you can do is make sure that as many things that can be @Stable are in fact @Stable, I don’t have any other ideas myself 😄Zoltan Demant
08/06/2022, 11:42 AMshikasd
08/06/2022, 2:00 PMZoltan Demant
08/06/2022, 2:39 PMshikasd
08/06/2022, 2:42 PMZoltan Demant
08/06/2022, 2:46 PMshikasd
08/06/2022, 2:47 PMZoltan Demant
08/07/2022, 3:04 PM