ChicoFormSubmitX extension

Validates a Form, runs action under busy, toasts on success/error.

await context.submitForm(
  formKey,
  action: () => api.save(),
  busyMessage: 'Saving',
  successMessage: 'Saved',
);
on

Methods

submitForm(GlobalKey<FormState> formKey, {required Future<void> action(), String? busyMessage, String? successMessage, String invalidMessage = 'Fix the fields', bool onError(Object error)?}) → Future<bool>

Available on BuildContext, provided by the ChicoFormSubmitX extension

Returns true when validation and action both succeed.