copyWith method

  1. @override
LightDimmingFull copyWith({
  1. double? brightness,
  2. double? minDimLevel,
  3. bool copyOriginalValues = true,
})
override

Returns a copy of this object with its field values replaced by the ones provided to this method.

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

@override
LightDimmingFull copyWith({
  double? brightness,
  double? minDimLevel,
  bool copyOriginalValues = true,
}) {
  LightDimmingFull toReturn = LightDimmingFull(
    brightness: copyOriginalValues
        ? originalBrightness
        : (brightness ?? this.brightness),
    minDimLevel: minDimLevel ?? this.minDimLevel,
  );

  if (copyOriginalValues) {
    toReturn.brightness = brightness ?? this.brightness;
  }

  return toReturn;
}