isEmail property

bool get isEmail

Whether the string is a valid email address.

Implementation

bool get isEmail {
  if (isNullOrEmpty) return false;
  final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,}$');
  return emailRegex.hasMatch(this!.trim());
}