Dart String Manipulations: Strings Validations

Dart String Manipulations: Strings Validations

Strings validation :

  • In dart string validation is check to your string field email is correct or incorrect email a email is correct to your answer is true and email is not correct to answer is false in String filed is checked

Example:

void main() {
  String userInput;
  userInput = "Hello@email.com";

 // String isVaild = "example@gmail.com";

  // false
  print(userInput);
  String isEmail;
  if (userInput.contains("@")) {
    isEmail = 'true';
  } else {
    isEmail = 'false';
  }
  print(isEmail);
}

Output:

Hello@email.com
true