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
- BaseFormController<
Success, Failure, State>
- BaseFormController<
- 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, emptyString, andint == 0from 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<
Inserts a newSuccess, Failure, State> , provided by the FormControllerUpdateItemsExtension extensionvalueinto the items list of an AsyncDropDownFieldState. -
insertAsyncRadioItem<
T> (String fieldName, {required T value, required String label, int index = 0}) → void -
Available on BaseFormController<
Inserts a new radio button item into the cached items of an async radio group field.Success, Failure, State> , provided by the FormControllerUpdateItemsExtension extension -
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<
Removes the focus listener for the specified text field. This is useful when cleaning up resources, such as duringSuccess, Failure, State> , provided by the TextFieldFormController extensiononClose()in a controller. -
removeTextFieldListener(
String fieldName) → void -
Available on BaseFormController<
Remove the listener registered for the given text field, if any.Success, Failure, State> , provided by the TextFieldFormController extension -
replaceAsyncDropDownItems<
T> (String fieldName, List< DropDownItemState< items) → voidT> > -
Available on BaseFormController<
Replaces all existing cached dropdown items with a new list of items.Success, Failure, State> , provided by the FormControllerUpdateItemsExtension extension -
replaceAsyncRadioItems<
T> (String fieldName, List< RadioButtonFieldState< items) → voidT> > -
Available on BaseFormController<
Replaces all cached radio button items in an async radio group field with a new list.Success, Failure, State> , provided by the FormControllerUpdateItemsExtension extension -
resolveAsyncField<
T> (String fieldName) → Future< T> -
Available on BaseFormController<
Resolves the value of an asynchronous hidden field and updates its state.dynamic, Error, BaseBondFormState< , provided by the AsyncFieldFormController extensiondynamic, Error> > -
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<
Retrieves the TextEditingController for a given text field and ensures it is observed.Success, Failure, State> , provided by the TextFieldFormController extension -
textFieldFocusNode(
String fieldName) → FocusNode -
Available on BaseFormController<
Retrieves the FocusNode for a given text field.Success, Failure, State> , provided by the TextFieldFormController extension -
toggleCheckbox<
T> (String fieldName, {required T value, bool? selected}) → void -
Available on BaseFormController<
Toggles the value of a specific checkbox within a checkbox group.dynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> > -
toString(
) → String -
A string representation of this object.
inherited
-
updateAsyncDropDown<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates a AsyncDropDownFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateAsyncDropDownItem<
T> (String fieldName, {required T value, required String label}) → void -
Available on BaseFormController<
Updates an existing dropdown item in an AsyncDropDownFieldState by its value.Success, Failure, State> , provided by the FormControllerUpdateItemsExtension extension -
updateAsyncHiddenField<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates a AsyncHiddenFieldState with a given value.dynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> > -
updateAsyncRadioGroup<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates an AsyncRadioGroupFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateAsyncRadioItem<
T> (String fieldName, {required T value, required String label}) → void -
Available on BaseFormController<
Updates the label of an existing radio button item in an async radio group field by its value.Success, Failure, State> , provided by the FormControllerUpdateItemsExtension extension -
updateCheckbox(
String fieldName, bool value) → void -
Available on BaseFormController<
Updates a CheckboxFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateCheckboxGroup<
T> (String fieldName, Set< T> value) → void -
Available on BaseFormController<
Updates a CheckboxGroupFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateDate(
String fieldName, DateTime? value) → void -
Available on BaseFormController<
Updates a DateFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateDropDown<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates a DropDownFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >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<
Updates a FileFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateHiddenField<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates a HiddenFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateRadioButton<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates a RadioButtonFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateRadioGroup<
T> (String fieldName, T value) → void -
Available on BaseFormController<
Updates a RadioGroupFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >value. -
updateRadioGroupItems<
T> (String fieldName, List< RadioButtonFieldState< items) → voidT> > -
Available on BaseFormController<
Updates a RadioGroupFieldState with a list of RadioButtonFieldState items.dynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> > -
updateText(
String fieldName, String? value) → void -
Available on BaseFormController<
Updates a TextFieldState with a givendynamic, Error, BaseBondFormState< , provided by the XFormController extensiondynamic, Error> >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