clampDouble method Null safety

double clampDouble(
  1. double min,
  2. double max,
  3. double input
)

Clamps an integer between two floating-point numbers.

Returns input when min <= input <= max, and either min or max otherwise.

Implementation

static double clampDouble(double min, double max, double input) {
  if (input < min) {
    return min;
  } else if (input > max) {
    return max;
  }

  return input;
}