mobile_skt/lib/util/validator_util.dart

12 lines
367 B
Dart
Raw Normal View History

2024-10-16 09:48:17 +08:00
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';
}
}