handleUpdateFormDataEvent method

FutureOr<void> handleUpdateFormDataEvent(
  1. BlocxFormEventUpdateFormData<P> event,
  2. Emitter<BlocxFormState<F, E>> emit
)
inherited

Handles replacing the full form data from a new payload.

This is useful when switching between create and update modes without recreating the bloc.

Implementation

FutureOr<void> handleUpdateFormDataEvent(
  BlocxFormEventUpdateFormData<P> event,
  Emitter<BlocxFormState<F, E>> emit,
) async {
  _isUpdate = event.isUpdate;
  formData = await applyPayloadToFormData(event.payload);

  emit(BlocxFormStateApplyInitialDataToForm(formData: formData));

  await validateForm(formData, forceFullValidation: true);

  emitState(emit);
}