Browse Source

Add a util to validate emails

Vishnu Mohandas 4 years ago
parent
commit
785481fccd
1 changed files with 5 additions and 0 deletions
  1. 5 0
      lib/utils/email_util.dart

+ 5 - 0
lib/utils/email_util.dart

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