copyWith method

  1. @override
HslColor copyWith({
  1. num? hue,
  2. num? saturation,
  3. num? lightness,
  4. int? alpha,
})
override

Returns a copy of this color modified with the provided values.

Implementation

@override
HslColor copyWith({num? hue, num? saturation, num? lightness, int? alpha}) {
  assert(hue == null || (hue >= 0 && hue <= 360));
  assert(saturation == null || (saturation >= 0 && saturation <= 100));
  assert(lightness == null || (lightness >= 0 && lightness <= 100));
  assert(alpha == null || (alpha >= 0 && alpha <= 255));
  return HslColor(
    hue ?? this.hue,
    saturation ?? this.saturation,
    lightness ?? this.lightness,
    alpha ?? this.alpha,
  );
}