valueInRange method Null safety

num valueInRange(
  1. num min,
  2. num max,
  3. [String? name]
)

If value is between min and max, returns it.

If value is fuzzyEquals to min or max, it's clamped to the appropriate value. Otherwise, this throws a SassScriptException. If this came from a function argument, name is the argument name (without the $). It's used for error reporting.

Implementation

num valueInRange(num min, num max, [String? name]) {
  var result = fuzzyCheckRange(value, min, max);
  if (result != null) return result;
  throw _exception(
      "Expected $this to be within $min$unitString and $max$unitString.",
      name);
}