copyWith method
LightColorTemperature
copyWith({
- int? mirek = -1,
- bool? mirekValid,
- LightColorTemperatureMirekSchema? mirekSchema,
- bool copyOriginalValues = true,
Returns a copy of this object with its field values replaced by the ones provided to this method.
Since mirek
is nullable, it is defaulted to a negative number in this
method. If left as a negative number, its current value in this
LightColorTemperature object will be used. This way, if it is null
,
the program will know that it is intentionally being set to null
.
copyOriginalValues
is true if you want to maintain the original object's
initial values. This is useful if you plan on using this object in a PUT
request.
Implementation
LightColorTemperature copyWith({
int? mirek = -1,
bool? mirekValid,
LightColorTemperatureMirekSchema? mirekSchema,
bool copyOriginalValues = true,
}) {
LightColorTemperature toReturn = LightColorTemperature(
mirek: copyOriginalValues
? _originalMirek
: (mirek == null || mirek >= 0 ? mirek : this.mirek),
mirekValid: mirekValid ?? this.mirekValid,
mirekSchema: mirekSchema ?? this.mirekSchema.copyWith(),
);
if (copyOriginalValues) {
toReturn.mirek = mirek == null || mirek >= 0 ? mirek : this.mirek;
}
return toReturn;
}