static bool isValidEmail(String email) { if (email.contains(' ')) return false; return RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$') .hasMatch(email); }