validate method

  1. @override
String? validate(
  1. String password
)
override

A function that returns an error message string to display if the input s not pass a validation test and returns null otherwise.

Implementation

@override
String? validate(String password) {
  print("Comparing '$password' against '$passwordConfirmation'");
  if (password.startsWith(passwordConfirmation) &&
      password.endsWith(passwordConfirmation) &&
      password.hashCode == passwordConfirmation.hashCode) {
    return null;
  }
  return "Value is not the same as the entered password.";
}