bool isEmailValid(String email) { // Regular expression for a basic email validation final emailPattern = r'^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*(\.[a-z]{2,4})$'; // Create a regular expression object final regExp = RegExp(emailPattern); // Use the hasMatch method to check if the email matches the pattern return regExp.hasMatch(email); } void main() { String email = "example@email.com"; // Replace with the email you want to verify if (isEmailValid(email)) { print('$email is a valid email address.'); } else { print('$email is not a valid email address.'); } }