copyWith method

  1. @override
RgbColor copyWith({
  1. num? red,
  2. num? green,
  3. num? blue,
  4. int? alpha,
})

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

Implementation

@override
RgbColor copyWith({num? red, num? green, num? blue, int? alpha}) {
  assert(red == null || (red >= 0 && red <= 255));
  assert(green == null || (green >= 0 && green <= 255));
  assert(blue == null || (blue >= 0 && blue <= 255));
  assert(alpha == null || (alpha >= 0 && alpha <= 255));
  return RgbColor(
    red ?? this.red,
    green ?? this.green,
    blue ?? this.blue,
    alpha ?? this.alpha,
  );
}