RangeError.range constructor

RangeError.range(
  1. num invalidValue,
  2. int? minValue,
  3. int? maxValue, [
  4. String? name,
  5. String? message,
])

Create a new RangeError for a value being outside the valid 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.

Implementation

@pragma("vm:entry-point")
RangeError.range(num invalidValue, int? minValue, int? maxValue,
    [String? name, String? message])
    : start = minValue,
      end = maxValue,
      super.value(invalidValue, name, message ?? "Invalid value");