I have seen examples in the android official documentation that exposing property like that
var showDialog = mutableStateOf(false) private set but i didn't see that properly encapsulates the showDialog var well, so intended for this approach
private var _showDialog = mutableStateOf(false) val showDialog get() = _showDialog which approach is much proper and better ?
but i didn't see that properly encapsulates the showDialog var well, how come? The approaches are basically equivalent. The second option is just defining a second useless variable._showDialogis still mutable, so if it changes thevalwill still change value because it re-fetches it every timegetis called. Avalis not immutable, it is just read-only.