confirmPassword static method

Validator<String?> confirmPassword(
  1. TextFieldBloc passwordTextFieldBloc
)

Check if the value of the current TextFieldBloc is equals to passwordTextFieldBloc.value.

Returns a Validator String Function(String string).

This validator check if the string is equal to the current value of the TextFieldBloc if string is not null and not empty.

Returns null if is valid.

Returns FieldBlocValidatorsErrors.email if is not valid.

Returns FieldBlocValidatorsErrors.passwordMin6Chars if is not valid.

Implementation

static Validator<String?> confirmPassword(
  TextFieldBloc passwordTextFieldBloc,
) {
  return (String? confirmPassword) {
    if (confirmPassword == null ||
        confirmPassword.isEmpty ||
        confirmPassword == passwordTextFieldBloc.value) {
      return null;
    }
    return FieldBlocValidatorsErrors.confirmPassword;
  };
}