validatePasswordConfirmation static method
Validates that a confirmation password matches the original.
Returns null if passwords match, or an error message if they don't.
password The original password.
confirmation The password confirmation. Can be null.
Implementation
static String? validatePasswordConfirmation(String? password, String? confirmation) {
if (confirmation == null || confirmation.isEmpty) {
return 'Please confirm your password';
}
if (password != confirmation) {
return 'Passwords do not match';
}
return null;
}