EmailValidator constructor

const EmailValidator([
  1. String? errorMessage
])

A validator that checks if a value is a valid email address.

This validator extends the EasyValidator class and overrides the validate method. It uses a regular expression to validate the email address format. If the value is not a valid email address, it returns the errorMessage. An example of how to use the EmailValidator class.

Example:

final email = 'example@example';
final validator = EmailValidator('Invalid email address');
String? result = validator.validate(email);
print(result); // Output: 'Invalid email address'

Implementation

const EmailValidator([super.errorMessage]);