Search packages, repositories and app categories

Package detailsv3.0.0

email_validator

A simple (but correct) dart class for validating email addresses

AndroidiOSWebmacOSWindowsLinux
30-day downloads
850K
Likes
1.2K
Pub points
160

Install package

flutter pub add email_validator

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The email_validator package provides a simple and accurate Dart class for validating email addresses according to standard RFC 5322 specifications. It ensures reliable email format checking across multiple platforms, including mobile, web, and desktop. The package is lightweight, easy to integrate, and suitable for form validation in Flutter applications. It supports both basic and advanced validation scenarios without requiring external dependencies.

Use cases

  • Form input validation
  • User registration flows
  • Login screen email checks
  • Data integrity verification
  • Real-time email feedback

Key features

  • RFC 5322 compliant validation
  • Cross-platform support
  • Simple API with clear error handling
  • Lightweight and dependency-free
  • Supports internationalized email addresses

Suitable for

  • Flutter apps needing email validation
  • Developers prioritizing correctness over speed
  • Applications requiring strict email format rules
  • Frontend validation in web and mobile apps
  • Projects with minimal external dependencies

Considerations

  • Does not verify if an email actually exists
  • No server-side validation included
  • May reject some valid but uncommon email formats
  • Limited to syntax checking, not delivery confirmation
  • Not suitable for high-volume email processing

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Email Validator.dart

CI pub package

A simple Dart class for validating email addresses without using RegEx. Can also be used to validate emails within Flutter apps (see Flutter email validation).

NB: This library only validates the syntax of the email, not by looking up domain or whether an email actually exists.

Featured in:

  1. How To Validate Emails in Flutter by https://github.com/lucianojung
  2. Flutter Tutorial - Email Validation In 7 Minutes by https://github.com/JohannesMilke
  3. Flutter Tutorial - Email Validation | Package of the week by https://github.com/Dhanraj-FlutterDev

Found in several big libraries and apps:

  1. Google Firebase
  2. Flutter GenUI
  3. Supabase - Flutter auth UI
  4. TubeCards - The world’s best flashcard platform
  5. Serverpod - Serverpod is a next-generation app and web server, explicitly built for Flutter
  6. Several other packages on pub.dev

And many more!

Installation

1. Depend on it

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

dependencies:
    email_validator: '^3.0.6'
2. Install it

You can install packages from the command line:

$ dart pub get

Alternatively, your editor might support pub. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:email_validator/email_validator.dart';

Usage

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

void main() {
    var email = 'fredrik@gmail.com';

    assert(EmailValidator.validate(email));
}

Tips

You can also use this repo as a template for creating Dart packages, just clone the repo and start hacking :)

Categories

Source repository

Projects using this package

Rankings