isEmail static method

bool isEmail(
  1. String value
)

Returns true for a valid email address.

Implementation

static bool isEmail(String value) {
  if (value.trim().length > 254) return false;
  final RegExp regex = RegExp(
    r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$",
  );
  return regex.hasMatch(value.trim());
}