12 lines
367 B
Dart
12 lines
367 B
Dart
class ValidatorUtil {
|
|
String? emailValidator(value) {
|
|
if (value == null || value == '') {
|
|
return 'Email is required';
|
|
}
|
|
const String regexEmail =
|
|
"^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$";
|
|
if (value == null || value.isEmpty) return null;
|
|
return RegExp(regexEmail).hasMatch(value) ? null : 'Email format error';
|
|
}
|
|
}
|