clamp static method

int clamp(
  1. int value, [
  2. int lowerLimit = 0,
  3. int upperLimit = 255
])

Implementation

static int clamp(int value, [int lowerLimit = 0, int upperLimit = 255]) {
  if (value < lowerLimit) return lowerLimit;
  if (value > upperLimit) return upperLimit;
  return value;
}