A robust and customizable email validation library for Dart and Flutter projects. Inspired by isEmail function from validator JavaScript library. It provides the following features:

  • Comprehensive email address validation
  • Customizable validation options
  • Support for display names in email addresses
  • Domain-specific validation (e.g., Gmail)
  • IP address domain support
  • UTF-8 local part support
  • Blacklist and whitelist domain functionality


Basic usage:

import 'package:better_email_validator/better_email_validator.dart';

void main() {
  print(isEmail('')); // true
  print(isEmail('invalid-email')); // false

Advanced usage with custom options:

import 'package:better_email_validator/better_email_validator.dart';

void main() {
  final options = EmailOptions(
    allowDisplayName: true,
    requireTld: true,
    allowIpDomain: false,
    domainSpecificValidation: true,

  print(isEmail('John Doe <>', options: options)); // true
  print(isEmail('user@', options: options)); // false

API Reference

isEmail(String str, {EmailOptions? options})

Validates an email address string.

  • str: The email address to validate.
  • options: An optional EmailOptions instance to customize validation behavior.

Returns true if the email is valid, false otherwise.


A class to customize email validation behavior.

Option Type Default Description
allowDisplayName bool false Allow display names (e.g., "John Doe")
requireDisplayName bool false Require display names
allowUtf8LocalPart bool true Allow UTF-8 characters in local part
requireTld bool true Require top-level domain
blacklistedChars String '' Disallow specified characters
ignoreMaxLength bool false Ignore maximum length validation
hostBlacklist List<String> [] Blacklist of disallowed domains
hostWhitelist List<String> [] Whitelist of allowed domains
domainSpecificValidation bool false Perform domain-specific validation (e.g., for Gmail)
allowIpDomain bool false Allow IP addresses as email domain


Contributions are welcome! Please feel free to submit a Pull Request.


This project is licensed under the MIT License.


Email validator inspired by the validator NPM package's isEmail function.