validate method

  1. @override
String? validate(
  1. String value
)
override

Returns ValidationMessages.invalidEmail if the value is not a valid email, otherwise null.

Implementation

@override
/// Returns `ValidationMessages.invalidEmail` if the value is not a valid email, otherwise `null`.
String? validate(String value) {
  if (!RegExp(ValidationPatterns.emailPattern).hasMatch(value)) {
    return ValidationMessages.invalidEmail;
  }
  return null;
}