CopyWith
In addition to the copyWith
method of each case-modddel, the super-sealed class has a copyWith
method too. However, this method only includes shared properties that have the same type across all case-modddels.
For example : Let's say we have a Weather
MultiValueObject union :
In this example, temperature
is a shared property of type int
, and it has the same type int
in both case-modddels. So it can be used in the super-sealed class's copyWith
method :
The original plan was that the super-sealed class's copyWith
method would include all shared properties, even when their types in the case-modddels is different. However, this could not be done due to a limitation in the Dart language related to inheritence.