XFormController extension

Extension methods for FormController providing more type-safe updates.

The XFormController extension adds methods to FormController to simplify updating the values of various form fields in a type-safe manner.

Example usage:

// Update the value of a text field.
controller.updateText('fieldName', 'new value');

// Update the value of a checkbox field.
controller.updateCheckbox('fieldName', true);

// Toggle a value in a checkbox group.
controller.toggleCheckbox('fieldName', value: 'value', selected: true);

Methods:

on

Methods

toggleCheckbox<T>(String fieldName, {required T value, bool? selected}) → void
Toggles the value of a specific checkbox within a checkbox group.
updateAsyncDropDown<T>(String fieldName, T value) → void
Updates a AsyncDropDownFieldState with a given value.
updateCheckbox(String fieldName, bool value) → void
Updates a CheckboxFieldState with a given value.
updateCheckboxGroup<T>(String fieldName, Set<T> value) → void
Updates a CheckboxGroupFieldState with a given value.
updateDate(String fieldName, DateTime? value) → void
Updates a DateFieldState with a given value.
updateDropDown<T>(String fieldName, T value) → void
Updates a DropDownFieldState with a given value.
updateFile(String fieldName, File? value) → void
Updates a FileFieldState with a given value.
updateHiddenField<T>(String fieldName, T value) → void
Updates a HiddenFieldState with a given value.
updateRadioButton<T>(String fieldName, T value) → void
Updates a RadioButtonFieldState with a given value.
updateRadioGroup<T>(String fieldName, T value) → void
Updates a RadioGroupFieldState with a given value.
updateText(String fieldName, String? value) → void
Updates a TextFieldState with a given value.