validate method

  1. @override
void validate(
  1. String? newValue
)
override

Implementation

@override
void validate(String? newValue) {
  final String? _newValue = newValue;

  if (_newValue == null || _newValue.isEmpty) {
    throw RequiredValueException();
  } else if (_newValue.length < minChar) {
    throw TooShortValueException();
  } else if (_newValue.length > maxChar) {
    throw TooLongValueException();
  } else if (mustContainLowerChar && !hasLowerChar(_newValue)) {
    throw MustContainLowerValueException();
  } else if (mustContainUpperChar && !hasUpperChar(_newValue)) {
    throw MustContainUpperValueException();
  } else if (mustContainNumeric && !hasNumeric(_newValue)) {
    throw MustContainNumberValueException();
  } else if (mustContainSpecialChar && !hasSpecialChar(_newValue)) {
    throw MustContainSpecialValueException();
  }
}