email static method

ValidationRule email({
  1. String message = 'Invalid email format',
})

Validation rule to check for valid email format.

Uses a simple regex and returns message if invalid.

Implementation

static ValidationRule email({String message = 'Invalid email format'}) {
  return ValidationRule(
    (value) => RegExp(_emailRegex).hasMatch(value ?? '') ? null : '',
    message,
  );
}