How should I check if the input is an email address in Flutter? [duplicate]

For that simple regex works pretty good.

const String email = "[email protected]"

final bool emailValid = 
    RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
      .hasMatch(email);

Leave a Comment