isEmail property

bool get isEmail

Checks if the string is a valid email address.

Example:

'a@b.com'.isEmail; // true
'not-an-email'.isEmail; // false

Implementation

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