copyWith<State extends BaseBondFormState<Success, Failure> > method
State
copyWith<State extends BaseBondFormState<Success, Failure> >({
- Map<
String, FormFieldState> ? fields, - BondFormStateStatus? status,
- Success? success,
- Failure? failure,
- int? currentStep,
override
Creates a copy of this StepperFormState with optional parameter overrides.
This method allows creating a new instance of StepperFormState with modified fields, status, success, failure, or current step.
fieldsA map of field names to their corresponding state objects to override.statusThe current status of the form to override.successThe success result of the form submission to override.failureThe failure result of the form submission to override.currentStepThe step number to override.- Returns: A new instance of StepperFormState with the provided overrides.
Implementation
State copyWith<State extends BaseBondFormState<Success, Failure>>({
Map<String, FormFieldState>? fields,
BondFormStateStatus? status,
Success? success,
Failure? failure,
int? currentStep,
}) {
return StepperFormState<Success, Failure>(
fields: fields ?? this.fields,
status: status ?? this.status,
success: success ?? successResult,
failure: failure ?? failureResult,
currentStep: currentStep ?? this.currentStep,
) as State; // Cast the result to the expected generic type.
}