svenjacobs
03/04/2024, 8:29 AMViewModel for example)
private val _selected = mutableStateOf(false)
val isSelected: Boolean
get() = _selected.value
and use isSelected in a composable, it gets recomposed when _selected changes although isSelected is a Boolean and not State<Boolean>. How does it work? What is the Compose compiler “magic” here? I would like to understand what’s going on.svenjacobs
03/04/2024, 8:32 AMshikasd
03/04/2024, 12:50 PM.value is executed.shikasd
03/04/2024, 12:51 PMSnapshot variable with a readObserver field on it. Whenever you call State.value, it calls that observer provided by composition.svenjacobs
03/04/2024, 12:57 PMZach Klippenstein (he/him) [MOD]
03/04/2024, 7:45 PMZach Klippenstein (he/him) [MOD]
03/04/2024, 7:48 PMZach Klippenstein (he/him) [MOD]
03/04/2024, 7:48 PMsvenjacobs
03/05/2024, 6:22 AMState and a composable, meaning it needs to be a State (on the first layer) when reading from a composable. I wasn’t aware that there is an implicit dependency which works even when reading a State through a layer of abstractions.svenjacobs
03/08/2024, 1:42 PM