@@ -5,7 +5,7 @@ import 'dart:core';
5
5
/// The Type enum
6
6
///
7
7
/// The domain type is either None, Alphabetic, Numeric or AlphaNumeric
8
- enum Type { None , Alphabetic , Numeric , AlphaNumeric }
8
+ enum SubdomainType { None , Alphabetic , Numeric , AlphaNumeric }
9
9
10
10
///The EmailValidator entry point
11
11
///
@@ -18,7 +18,7 @@ class EmailValidator {
18
18
static const String _atomCharacters = "!#\$ %&'*+-/=?^_`{|}~" ;
19
19
20
20
// Sets default domainType to null on initialization
21
- static Type _domainType = Type .None ;
21
+ static SubdomainType _domainType = SubdomainType .None ;
22
22
23
23
// Returns true if the first letter in string c has a 16-bit UTF-16 code unit
24
24
// greater than or equal to 48 and less than or equal to 57
@@ -69,20 +69,20 @@ class EmailValidator {
69
69
static bool _isDomain (String c, bool allowInternational) {
70
70
if (c.codeUnitAt (0 ) < 128 ) {
71
71
if (_isLetter (c) || c == '-' ) {
72
- _domainType = Type .Alphabetic ;
72
+ _domainType = SubdomainType .Alphabetic ;
73
73
return true ;
74
74
}
75
75
76
76
if (_isDigit (c)) {
77
- _domainType = Type .Numeric ;
77
+ _domainType = SubdomainType .Numeric ;
78
78
return true ;
79
79
}
80
80
81
81
return false ;
82
82
}
83
83
84
84
if (allowInternational) {
85
- _domainType = Type .Alphabetic ;
85
+ _domainType = SubdomainType .Alphabetic ;
86
86
return true ;
87
87
}
88
88
@@ -94,26 +94,26 @@ class EmailValidator {
94
94
static bool _isDomainStart (String c, bool allowInternational) {
95
95
if (c.codeUnitAt (0 ) < 128 ) {
96
96
if (_isLetter (c)) {
97
- _domainType = Type .Alphabetic ;
97
+ _domainType = SubdomainType .Alphabetic ;
98
98
return true ;
99
99
}
100
100
101
101
if (_isDigit (c)) {
102
- _domainType = Type .Numeric ;
102
+ _domainType = SubdomainType .Numeric ;
103
103
return true ;
104
104
}
105
105
106
- _domainType = Type .None ;
106
+ _domainType = SubdomainType .None ;
107
107
108
108
return false ;
109
109
}
110
110
111
111
if (allowInternational) {
112
- _domainType = Type .Alphabetic ;
112
+ _domainType = SubdomainType .Alphabetic ;
113
113
return true ;
114
114
}
115
115
116
- _domainType = Type .None ;
116
+ _domainType = SubdomainType .None ;
117
117
118
118
return false ;
119
119
}
@@ -174,7 +174,7 @@ class EmailValidator {
174
174
175
175
// Note: by allowing AlphaNumeric,
176
176
// we get away with not having to support punycode.
177
- if (_domainType == Type .Numeric ) {
177
+ if (_domainType == SubdomainType .Numeric ) {
178
178
return false ;
179
179
}
180
180
0 commit comments