Email Sanity
A robust Flutter package designed to provide enhanced email validation with additional layers of accuracy and reliability. Building on the foundation of the popular email_validator package, EmailSanity introduces extra "magic" to ensure that the emails you process are not just syntactically correct, but also contextually appropriate and ready for real-world use.
It validates the email syntax and checks as well as the domains to ensure the email provided is accurate.
Email Providers Being Checked:
- Yahoo
- Microsoft
- Apple
- Yandex
- Fastmail
Installation
1. Add Package
Add this to your package's pubspec.yaml file:
dependencies:
email_sanity: '^1.0.0'
2. Run Pub Get
$ pub get
..
3. Import Email Sanity
import 'package:email_sanity/email_sanity.dart';
Usage
Basic Validation
void main() {
var email = "email@gmail.com";
assert(EmailSanity.validate(email));
}
Validation with Details
void main() {
var email = "email@gmail.com";
var result = EmailSanity.validateWithDetails(email);
print('Is valid: ${result.isValid}');
print('Error message: ${result.errorMessage}');
}