isEmail function

IValidator isEmail()

Validates that the String is a valid email address.

Implementation

IValidator isEmail() {
  // A simple regex for email validation. For a more robust one, consider a dedicated package.
  final emailRegex = RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$');
  return isString() & stringMatchesPattern(emailRegex, error: 'a valid email address');
}