Skipping, @Stable & @Immutable
Mark types so Compose can skip work.
When You Need Annotations
Sometimes a type is truly safe but Compose cannot prove it. Annotations let you promise stability so skipping kicks back in.
The @Immutable Promise
@Immutable tells Compose that once an instance is built, none of its properties will ever change. It is the strongest stability guarantee.
@Immutable
data class Theme(val primary: Long, val radius: Int)All lessons in this course
- Stable vs Unstable Parameters
- Skipping, @Stable & @Immutable
- Deferring State Reads
- Layout Inspector & Recomposition Counts