isMail property

bool isMail

Checks whether the String is a valid mail.

Example

String foo = 'esentis@esentis.com';
bool isMail = foo.isMail; // returns true

Implementation

bool get isMail {
  if (this.isBlank) {
    return false;
  }
  var regex = RegExp(r"(^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$)");
  return regex.hasMatch(this);
}