email static method

bool email(
  1. String email
)

Validates whether the given email is a valid email address.

The email parameter should be a string representing an email address.

Returns true if the email is valid, false otherwise.

Implementation

static bool email(String email) {
  String emailRegEx =
      r'^[a-zA-Z0-9.a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9]+\.[a-zA-Z0-9.]{2,}$';
  RegExp regExp = RegExp(emailRegEx);
  return regExp.hasMatch(email);
}