validateValue method

  1. @override
String? validateValue(
  1. T valueCandidate
)
override

Validates the value. Returns null if the value is valid, otherwise an error message. Call validate() instead of this method when using the validator.

Implementation

@override
String? validateValue(T valueCandidate) {
  final String? minResult = _minValidator.validate(valueCandidate);
  final String? maxResult = _maxValidator.validate(valueCandidate);
  final String? minLengthResult = _minLengthValidator.validate(
    valueCandidate,
  );
  final String? maxLengthResult = _maxLengthValidator.validate(
    valueCandidate,
  );

  if ((minResult == null && maxResult == null) ||
      (minLengthResult == null && maxLengthResult == null)) {
    return null;
  } else {
    return errorText;
  }
}