RangeError.range(num invalidValue, int minValue, int maxValue, [String name, String message])

Create a new RangeError with for an invalid value being outside a range.

The allowed range is from minValue to maxValue, inclusive. If minValue or maxValue are null, the range is infinite in that direction.

For a range from 0 to the length of something, end exclusive, use RangeError.index.

An optional name can specify the argument name that has the invalid value, and the message can override the default error description.

Source

RangeError.range(num invalidValue, int minValue, int maxValue,
                 [String name, String message])
    : start = minValue,
      end = maxValue,
      super.value(invalidValue, name,
                  (message != null) ? message : "Invalid value");