validate method
void
validate(
- String? newValue
)
override
Implementation
@override
void validate(String? newValue) {
final String? _newValue = newValue;
if (_newValue == null || _newValue.isEmpty) {
if (isRequired) {
throw RequiredValueException();
} else {
return;
}
}
final int? maxLenghtLocal = maxLenght;
final int? minLenghtLocal = minLenght;
if (maxLenghtLocal == null && minLenghtLocal == null) {
return;
}
final String? parsedString = valueText;
if (parsedString == null) {
throw RequiredValueException();
}
if (maxLenghtLocal != null) {
if (parsedString.length > maxLenghtLocal) {
throw TooLongValueException();
}
}
if (minLenghtLocal != null) {
if (parsedString.length < minLenghtLocal) {
throw TooShortValueException();
}
}
}