emailValidator static method

String? emailValidator(
  1. String? value
)

Implementation

static String? emailValidator(String? value) {
  if (value == null) {
    return "Email can't be empty";
  }
  if (RegExp(r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$')
          .hasMatch(value) &&
      value.isNotEmpty) {
    return null;
  }
  return "Email address is invalid";
}