LEDColor constructor

LEDColor({
  1. required int red,
  2. required int green,
  3. required int blue,
})

Constructs an LEDColor with the specified red, green, and blue values and checks the arguments.

Implementation

LEDColor({required this.red, required this.green, required this.blue}) {
  if (red < 0 || red > 255) {
    throw ArgumentError.value(
        red, 'red', 'The red value must be between 0 and 255.');
  }
  if (green < 0 || green > 255) {
    throw ArgumentError.value(
        green, 'green', 'The green value must be between 0 and 255.');
  }
  if (blue < 0 || blue > 255) {
    throw ArgumentError.value(
        blue, 'blue', 'The blue value must be between 0 and 255.');
  }
}