I see this code in one of the Android sample apps (Jetsnack):
@Stable class Filter(
val name: String,
enabled: Boolean = false,
val icon: ImageVector? = null
) {
val enabled = mutableStateOf(enabled)
}
which has me wondering why the “val enabled” property is not passed in the constructor and the class is not a data class. Is this some sort of compose pattern? Possibly to use in a destructured access to the “setEnabled” setter, which I do observe in Jetsnack.
a
Albert Chang
10/14/2022, 8:52 AM
Mutable classes shouldn't be data classes and you shouldn't override