mobile_skt/lib/util/validator_util.dart

12 lines
371 B
Dart
Raw Normal View History

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