isEmail property

bool isEmail

Checks if the string is in a valid email format.

Example:

print('user@example.com'.isEmail); // Output: true
print('user@example'.isEmail); // Output: false

Implementation

bool get isEmail => RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(this);