isEmail property

bool get isEmail

Returns true if string matches Email format.

final str1 = "askme@ask.com";
final str2 = "xyz";
str1.isEmail;  // true
str2.isEmail;  // false

Implementation

bool get isEmail => RegExp(
        r"^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$",
        caseSensitive: false)
    .hasMatch(this);