beAnEmail method
Instructs StringMust to make sure the given string is a valid email. Note that this is just a simple regex check from ihateregex.io that should cover most use cases. The backend should be responsible for anything more complicated.
Implementation
void beAnEmail([String? errorMessage]) {
match(RegExp('[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+'),
errorMessage ?? 'The string is not a valid email address.');
}