mobile_skt/lib/util/validator_util.dart

12 lines
367 B
Dart
Raw Normal View History

class ValidatorUtil {
String? emailValidator(value) {
if (value == null || value == '') {
return 'Email is required';
}
2024-03-31 17:13:29 +08:00
const String regexEmail =
"^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$";
if (value == null || value.isEmpty) return null;
2024-03-31 17:13:29 +08:00
return RegExp(regexEmail).hasMatch(value) ? null : 'Email format error';
}
}