Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
val prevents reassignment of a reference, not mutation of its object. A data-class copy is shallow, so nested mutable objects can remain shared.
A val holding a mutable list still allows list changes. Copying a data class creates a new outer instance while constructor properties containing references can still refer to the same objects. Prefer immutable state models and deliberate replacement when publishing screen state. If deep copying is needed, define which nested values must become independent.