isValidRomanNumeralValue method
Confirms or disconfirms a valid Roman numeral value. This may change for the same int depending on the RomanNumeralsConfig.
Implementation
bool isValidRomanNumeralValue({RomanNumeralsConfig? config}) {
config ??= RomanNumerals.romanNumeralsConfig;
// no negative number support
if (this < 0) {
return false;
}
// If nulla is not specified, we don't support zero.
if (config.nulla == null && this == 0) {
return false;
}
// Check the maximum values.
switch (config.configType) {
case RomanNumeralsType.common:
return !(this > 3999);
case RomanNumeralsType.apostrophus:
final aConfig = config as ApostrophusRomanNumeralsConfig;
if (aConfig.compact) {
return !(this > 399999);
} else {
return !(this > 3999999);
}
case RomanNumeralsType.vinculum:
return !(this > 3999999);
}
}