validateEmail static method
Implementation
static String? validateEmail(String? value, {String? message}) {
if (value == null || value.isEmpty) {
return message ?? 'Correo requerido';
}
final RegExp emailRegex = RegExp(
r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}',
caseSensitive: false,
multiLine: false,
);
if (!emailRegex.hasMatch(value)) {
return message ?? 'Por favor ingresa un correo electrónico válido';
}
return null;
}