email static method
Email validation
Implementation
static String? email(String? value, [String? message]) {
if (value == null || value.isEmpty) return null;
final regex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
if (!regex.hasMatch(value)) {
return message ?? 'Please enter a valid email address';
}
return null;
}