validateValue method

  1. @override
String? validateValue(
  1. String 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(String valueCandidate) {
  if (substring.isEmpty) {
    return errorText;
  } else if (caseSensitive
      ? valueCandidate.contains(substring)
      : valueCandidate.toLowerCase().contains(substring.toLowerCase())) {
    return null;
  }
  return errorText;
}