call method

  1. @override
Object? call(
  1. String value
)
override

Implementation

@override
Object? call(String value) {
  if (minLength != null && value.length < minLength!) {
    return TextValidationError(
      validation: this,
      code: errorCode,
      minLength: minLength,
    );
  } else if (maxLength != null && value.length > maxLength!) {
    return TextValidationError(
      validation: this,
      code: errorCode,
      maxLength: maxLength,
    );
  } else if (match != null && !match!.hasMatch(value)) {
    return TextValidationError(
      validation: this,
      code: errorCode,
      match: match?.pattern,
    );
  } else if (notMatch != null && notMatch!.hasMatch(value)) {
    return TextValidationError(
      validation: this,
      code: errorCode,
      notMatch: notMatch?.pattern,
    );
  }
  return null;
}