Email_Validator_Flutter pub package

Email validator Flutter and Dart package is used to validate email addresses both in Dart and Flutter. It uses Regex for validation. It is purely based on Dart, with no other dependencies. I will share a link to a complete example of a project in which I have used this email validation in Flutter

Installation

1. Add Dependency

Add this to your package's pubspec.yaml file:

dependencies:
    email_validator_flutter: '^1.0.0'

Also, you can use pub command to this email validator flutter package. Like this:

$ dart pub add email_validator_flutter

2. Install it

You can install packages from the command line:

$ pub get

3. Import it

Now in your Dart code, you can use:

import 'package:email_validator_flutter/email_validator_flutter.dart';

Usage

Read the unit tests under test, or see the code example below:

void main() {

  EmailValidatorFlutter emailValidatorFlutter = EmailValidatorFlutter();
  final email1 = 'test@example.com';
  final email2 = 'invalid_email@';

  print('$email1 is valid: ${emailValidatorFlutter.validateEmail(email1)}');
  print('$email2 is valid: ${emailValidatorFlutter.validateEmail(email2)}');
}

Extras

I have created this Flutter email validation package. If you get benefited from it please like and share it.

Libraries

email_validator_flutter
Support for doing something awesome.