email static method
Implementation
static String? Function(dynamic) email({String message = "Invalid email"}) {
final emailRegex = RegExp(r'^[^@]+@[^@]+\.[^@]+');
return (value) {
if (value == null || value is! String || value.isEmpty) {
return null;
}
if (!emailRegex.hasMatch(value)) return message;
return null;
};
}