toFailure method

FormBlocState<SuccessResponse, FailureResponse> toFailure (
  1. {FailureResponse failureResponse}
)

Returns a FormBlocFailure state with the properties of the current state.

It is the state when the form are submitting and fail. The previous state must be FormBlocSubmitting.

It has FailureResponse to indicate more details.

Implementation

FormBlocState<SuccessResponse, FailureResponse> toFailure({
  FailureResponse failureResponse,
}) =>
    FormBlocFailure(
      isValidByStep: _isValidByStep,
      isEditing: isEditing,
      failureResponse: failureResponse ??
          (runtimeType ==
                  _typeOf<FormBlocFailure<SuccessResponse, FailureResponse>>()
              ? (this as FormBlocFailure<SuccessResponse, FailureResponse>)
                  .failureResponse
              : null),
      fieldBlocs: _fieldBlocs,
      currentStep: currentStep ?? 0,
    );