Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/email_validator.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
library email_validator;

import 'dart:core';
import 'tld_validator.dart';

enum type { None, Alphabetic, Numeric, AlphaNumeric }

Expand Down Expand Up @@ -292,7 +293,7 @@ class EmailValidator {
/// will use the newer International Email standards for validating
/// the email address.
static bool validate(String email,
[bool allowTopLevelDomains = false, bool allowInternational = true]) {
[bool allowTopLevelDomains = false, bool allowInternational = true, bool knownTld = false]) {
_index = 0;

if (email.isEmpty || email.length >= 255) {
Expand Down Expand Up @@ -341,6 +342,10 @@ class EmailValidator {
return false;
}

if (knownTld == true) {
return TldValidator.hasKnownTld(email);
}

return _index == email.length;
}

Expand Down
Loading