I see this code in one of the Android sample apps ...
# compose
p
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
Mutable classes shouldn't be data classes and you shouldn't override
equals()
or
hashCode()
yourself, otherwise they are not stable.