isEmail property

bool get isEmail

Whether this string is a valid email address.

Implementation

bool get isEmail {
  if (length > 254) return false;
  final RegExp emailRegExp = RegExp(
    r'^[\w.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$',
  );
  return emailRegExp.hasMatch(this);
}