email static method
Validates email format.
Implementation
static FormFieldValidator<String> email([String? message]) => (value) {
if (value == null || value.trim().isEmpty) return null;
final regex = RegExp(r'^[\w._%+\-]+@[\w.\-]+\.[a-zA-Z]{2,}$');
if (!regex.hasMatch(value.trim())) {
return message ?? 'Please enter a valid email address';
}
return null;
};