validatePasswordForPasswordChange abstract method
Performs validation of the password during a PasswordChange operation.
If validation fails, the implementation must invoke the provided onError
with the error. The error will be the one returned by the PasswordChangeContext.lastRecoverableError
property.
The implementation must guarantee that, one (and only one) of onSuccess
and onError
is invoked, and that the one invoked is invoked only once.
This method will be invoked in the main/UI thread.
Synchronous implementation example that requires the password to have at least 8 characters:
@override
void validatePasswordForPasswordChange({
required String password,
required Function onSuccess,
required Function(PasswordChangeRecoverableCustomValidationError) onError
}) {
if (!isAtLeast8CharacterLong(password)) {
final error = PasswordChangeRecoverableCustomValidationError.create(
"The password has less than 8 characters.",
);
onError(error)
} else {
onSuccess();
}
}
Params:
Implementation
void validatePasswordForPasswordChange({
required String password,
required Function onSuccess,
required Function(PasswordChangeRecoverableCustomValidationError) onError,
});