isEmailAddress property

bool get isEmailAddress

Returns true if this string appears to be an email address.

Uses a simple pattern: local@domain.tld. Does not validate leading/trailing whitespace - returns false if the string needs trimming.

Implementation

bool get isEmailAddress {
  final trimmed = trim();
  if (trimmed != this) return false;
  final re = RegExp(r'^[^@\s]+@[^@\s]+\.[^@\s]+$');
  return re.hasMatch(trimmed);
}