Flutter/Dart - Validate Email Address

in #flutter2 years ago

Email validation - requires in almost all apps, isn't it?

Here is the code snippet which may save your time.

extension EmailValidator on String {
  bool isValidEmail() {
    return RegExp(
        r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')
        .hasMatch(this);
  }
}
Sort:  

Congratulations @sagarkothari88! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You received more than 1250 upvotes.
Your next target is to reach 1500 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Month - Feedback from February day 22
Support the HiveBuzz project. Vote for our proposal!