tryValidate method

  1. @override
String? tryValidate()
override

Validates the form field value

Implementation

@override
String? tryValidate() {
  RegExp exp = RegExp(r"^[a-zA-Z0-9]+$");
  if (!exp.hasMatch(value)) {
    if (customMessage == null) {
      return buildMessage(ValidatorStrings.alphaNum, attribute);
    }
    return customMessage;
  }
  return null;
}