assertValue function

void assertValue(
  1. int value
)

Assert that the color value is somewhere from 0 - 255. Will throw InvalidValueRangeException if not in range.

Implementation

void assertValue(int value) {
  const range = (lower: 0, upper: 255);
  if (_inRange(range: range, value: value)) return;
  throw InvalidValueRangeException(value: value, range: range);
}