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:

on

Methods

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.
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.
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.
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.