Peng Wang
04/10/2022, 12:07 PMhttps://developer.android.com/reference/kotlin/androidx/compose/runtime/Immutablethe doc of
@Immutable said that “data classes that only contain val properties that do not have custom getters can safely be marked as Immutable if the types of properties are either primitive types or also Immutable”
I thought the data class with val properties should have been treated as Stable (or Immutable) by Compiler , isn’t it ? if I don’t annotate Person with `@Immutable`,means the PersonView can’t skip the unnecessary Recomposition?Albert Chang
04/10/2022, 1:14 PMPeng Wang
04/10/2022, 1:18 PM@Immutable of Person in the sample doesn’t make any sense, right? https://developer.android.com/reference/kotlin/androidx/compose/runtime/ImmutablePaul Woitaschek
04/10/2022, 1:53 PMPaul Woitaschek
04/10/2022, 1:54 PMPeng Wang
04/10/2022, 2:00 PMAlbert Chang
04/10/2022, 3:05 PMAlbert Chang
04/10/2022, 3:09 PMPaul Woitaschek
04/10/2022, 3:10 PMPaul Woitaschek
04/10/2022, 3:11 PMPeng Wang
04/10/2022, 5:34 PMImmutable, and also I rarely see it in other people’s code. What I want to know is whether Immutable should always be marked for data class, even if it is stable. What is the bad case if don’t mark it for the data class? @Albert ChangPaul Woitaschek
04/10/2022, 5:38 PMPeng Wang
04/10/2022, 6:03 PMPerson of official sample, is stable itself right? why it still needs to be marked as Immutable ?Paul Woitaschek
04/10/2022, 6:15 PMhfhbd
04/11/2022, 4:10 AMAlbert Chang
04/11/2022, 4:13 AM