toSubmitting method

FormBlocState<SuccessResponse, FailureResponse> toSubmitting({
  1. double? progress,
})

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

It is the state when the FormBloc is submitting. It is called automatically when FormBloc.submit is called successfully, and usually is used to update the submission progress.

progress must be greater than or equal to 0.0 and less than or equal to 1.0.

  • If progress is less than 0, it will become 0.0
  • If progress is greater than 1, it will become 1.0

Implementation

FormBlocState<SuccessResponse, FailureResponse> toSubmitting(
    {double? progress}) {
  final state = this;
  return FormBlocSubmitting(
    isValidByStep: _isValidByStep,
    isEditing: isEditing,
    progress: progress ??
        (state is FormBlocSubmitting<SuccessResponse, FailureResponse>
            ? state.progress
            : 0.0),
    isCanceling: state is FormBlocSubmitting<SuccessResponse, FailureResponse>
        ? state.isCanceling
        : false,
    fieldBlocs: _fieldBlocs,
    currentStep: currentStep,
  );
}