mirror of https://github.com/flutter/samples.git
11 lines
254 B
11 lines
254 B
2 years ago
|
/// Returns true if the given String is a valid email address.
|
||
|
bool isValidEmail(String text) {
|
||
|
return RegExp(
|
||
|
r'(?<name>[a-zA-Z0-9]+)'
|
||
|
r'@'
|
||
|
r'(?<domain>[a-zA-Z0-9]+)'
|
||
|
r'\.'
|
||
|
r'(?<topLevelDomain>[a-zA-Z0-9]+)',
|
||
|
).hasMatch(text);
|
||
|
}
|