indexOutOfRange method
Throws a RangeError if input
is not a valid enum index. Returns input
otherwise.
Implementation
int indexOutOfRange(int input, Iterable values, {String? name}) {
if (values.length - 1 < input || input < 0) {
throw RangeError.index(input, values);
}
return input;
}