validateValue method
Validates the parsed value,
throwing a FormatException if the value is invalid,
or a UsageException if the value is invalid for other reasons.
Subclasses may override this method to perform specific validations. If they do, they must also call the super implementation.
Implementation
@override
@mustCallSuper
void validateValue(final V value) {
super.validateValue(value);
final mininum = min;
if (mininum != null && value.compareTo(mininum) < 0) {
throw FormatException(
'${valueParser.format(value)} is below the minimum '
'(${valueParser.format(mininum)})',
);
}
final maximum = max;
if (maximum != null && value.compareTo(maximum) > 0) {
throw FormatException(
'${valueParser.format(value)} is above the maximum '
'(${valueParser.format(maximum)})',
);
}
}