validate method
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.";
}