FormControllerUpdateItemsExtension<Success, Failure extends Error, State extends BaseBondFormState<Success, Failure> > extension
Extension methods for BaseFormController to manage async dropdown items.
The FormControllerUpdateItemsExtension provides utility methods for dynamically
modifying the cached item list of AsyncDropDownFieldState within a form controller.
These methods are particularly useful in scenarios like inline creation, dynamic updates, or injecting new options into dropdowns without waiting for the API to refetch.
Example usage:
// Insert a new item at the top of the dropdown
formController.insertAsyncDropDownItem<String>(
'addressId',
value: '123',
label: 'New Address',
);
// Update the label of an existing item
formController.updateAsyncDropDownItem<String>(
'addressId',
value: '123',
label: 'Updated Address Name',
);
Methods:
- insertAsyncDropDownItem Adds a new dropdown item to the cached list at a given index.
- updateAsyncDropDownItem Updates the label of an existing cached dropdown item.
- replaceAsyncDropDownItems Replaces all cached dropdown items with a new list.
- on
-
- BaseFormController<
Success, Failure, State>
- BaseFormController<
Methods
-
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 -
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 -
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 -
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