Dominik Seemayr
02/16/2022, 6:07 PMMutableState, I can expose it as read-only value to other classes as State<String>, just like:
private val _title = mutableStateOf("abc")
val title: State<String> = _title
Is there a way to do this with SnapshotStateList<> too? How would I do this for example with:
private val _titles = mutableStateListOf<String>(...)
val titles: ??? = _titlesAlbert Chang
02/16/2022, 6:28 PMval titles: List<String>
get() = _titlesAlbert Chang
02/16/2022, 6:30 PMMutableState case can be simplified to:
var title by mutableStateOf("abc")
private setDominik Seemayr
02/16/2022, 6:33 PMAlbert Chang
02/16/2022, 7:11 PMDominik Seemayr
02/16/2022, 7:52 PMColton Idle
02/16/2022, 9:25 PMDominik Seemayr
02/16/2022, 9:27 PMtad
02/18/2022, 4:06 AMState<T> allows consumers to obtain the state holder without performing a read, while var ... by mutableStateOf(...) forces a read when the field is accessed.