BodyConvertible<Success, Failure extends Error, State extends BaseBondFormState<Success, Failure>> mixin

A mixin that adds functionality to convert form state into a map of key-value pairs suitable for creating a request body.

This mixin provides:

  • Transformation of form fields using registered transformers.
  • Options to ignore certain keys, empty values, or remap keys.
  • Support for merging nested maps and post-processing the body.
Superclass constraints
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
ignoredBodyKeys Set<String>
Fields listed here will be excluded from the request body.
no setter
ignoreEmptyValues bool
Whether to exclude null, empty String, and int == 0 from the body.
no setter
mergeNestedMaps bool
If a transformed value is a Map<String, dynamic>, merge it into the root instead of assigning to a single key.
no setter
remapKeys Map<String, String>
Remap field keys before placing them into the final request body.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ↔ State
Returns the current state of the form.
getter/setter pairinherited
stopOnFirstError bool
A flag indicating if the validation should stop on encountering the first error.
getter/setter pairinherited

Methods

body() Map<String, dynamic>
Generates a map from the form state, applying any transformations specified by the fieldTransformers method.
clear() → void
Clears the form state and resets it to its initial pristine state.
inherited
fields() Map<String, FormFieldState>
Returns the map of field names to their corresponding FormFieldState.
inherited
fieldTransformers(TransformersRegistry registry) → void
Registers transformers for specific field types or keys.
insertAsyncDropDownItem<T>(String fieldName, {required T value, required String label, int index = 0}) → void

Available on BaseFormController<Success, Failure, State>, provided by the FormControllerUpdateItemsExtension extension

Inserts a new value into the items list of an AsyncDropDownFieldState.
insertAsyncRadioItem<T>(String fieldName, {required T value, required String label, int index = 0}) → void

Available on BaseFormController<Success, Failure, State>, provided by the FormControllerUpdateItemsExtension extension

Inserts a new radio button item into the cached items of an async radio group field.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFailure(Failure error) → void
Called when form submission fails. Can be overridden.
inherited
onSubmit() Future<Success>
To be implemented by the subclass, detailing what should happen when a form is submitted.
inherited
onSuccess(Success result) → void
Called when the form is successfully submitted. Can be overridden.
inherited
postProcessBody(Map<String, dynamic> body) Map<String, dynamic>
Optionally apply post-processing to the body map.
removeTextFieldFocusListener(String fieldName) → void

Available on BaseFormController<Success, Failure, State>, provided by the TextFieldFormController extension

Removes the focus listener for the specified text field. This is useful when cleaning up resources, such as during onClose() in a controller.
removeTextFieldListener(String fieldName) → void

Available on BaseFormController<Success, Failure, State>, provided by the TextFieldFormController extension

Remove the listener registered for the given text field, if any.
replaceAsyncDropDownItems<T>(String fieldName, List<DropDownItemState<T>> items) → void

Available on BaseFormController<Success, Failure, State>, provided by the FormControllerUpdateItemsExtension extension

Replaces all existing cached dropdown items with a new list of items.
replaceAsyncRadioItems<T>(String fieldName, List<RadioButtonFieldState<T>> items) → void

Available on BaseFormController<Success, Failure, State>, provided by the FormControllerUpdateItemsExtension extension

Replaces all cached radio button items in an async radio group field with a new list.
resolveAsyncField<T>(String fieldName) Future<T>

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the AsyncFieldFormController extension

Resolves the value of an asynchronous hidden field and updates its state.
setError(String fieldName, String? error) → void
Sets an error message for the specified field and updates the form state to invalid.
inherited
submit() Future<void>
Initiates the form submission process.
inherited
textFieldController(String fieldName) TextEditingController

Available on BaseFormController<Success, Failure, State>, provided by the TextFieldFormController extension

Retrieves the TextEditingController for a given text field and ensures it is observed.
textFieldFocusNode(String fieldName) FocusNode

Available on BaseFormController<Success, Failure, State>, provided by the TextFieldFormController extension

Retrieves the FocusNode for a given text field.
toggleCheckbox<T>(String fieldName, {required T value, bool? selected}) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Toggles the value of a specific checkbox within a checkbox group.
toString() String
A string representation of this object.
inherited
updateAsyncDropDown<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a AsyncDropDownFieldState with a given value.
updateAsyncDropDownItem<T>(String fieldName, {required T value, required String label}) → void

Available on BaseFormController<Success, Failure, State>, provided by the FormControllerUpdateItemsExtension extension

Updates an existing dropdown item in an AsyncDropDownFieldState by its value.
updateAsyncHiddenField<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a AsyncHiddenFieldState with a given value.
updateAsyncRadioGroup<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates an AsyncRadioGroupFieldState with a given value.
updateAsyncRadioItem<T>(String fieldName, {required T value, required String label}) → void

Available on BaseFormController<Success, Failure, State>, provided by the FormControllerUpdateItemsExtension extension

Updates the label of an existing radio button item in an async radio group field by its value.
updateCheckbox(String fieldName, bool value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a CheckboxFieldState with a given value.
updateCheckboxGroup<T>(String fieldName, Set<T> value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a CheckboxGroupFieldState with a given value.
updateDate(String fieldName, DateTime? value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a DateFieldState with a given value.
updateDropDown<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a DropDownFieldState with a given value.
updateError(String fieldName, String error) → void
Updates the error message for the specified field and performs additional validation.
inherited
updateFile(String fieldName, File? value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a FileFieldState with a given value.
updateHiddenField<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a HiddenFieldState with a given value.
updateRadioButton<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a RadioButtonFieldState with a given value.
updateRadioGroup<T>(String fieldName, T value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a RadioGroupFieldState with a given value.
updateRadioGroupItems<T>(String fieldName, List<RadioButtonFieldState<T>> items) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a RadioGroupFieldState with a list of RadioButtonFieldState items.
updateText(String fieldName, String? value) → void

Available on BaseFormController<dynamic, Error, BaseBondFormState<dynamic, Error>>, provided by the XFormController extension

Updates a TextFieldState with a given value.
updateValue<T extends FormFieldState<G>, G>(String fieldName, G value) → void
Updates the field value and status.
inherited
validate() → void
Validates all fields in the form.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited