replaceAsyncRadioItems<T> method

void replaceAsyncRadioItems<T>(
  1. String fieldName,
  2. List<RadioButtonFieldState<T>> items
)

Replaces all cached radio button items in an async radio group field with a new list.

  • fieldName: The name of the async radio group field to update.
  • items: The new list of radio button items to set.

Implementation

void replaceAsyncRadioItems<T>(
  String fieldName,
  List<RadioButtonFieldState<T>> items,
) {
  final field = state.asyncRadioGroup<T>(fieldName);

  state.fields[fieldName] = field.copyWith(
    cachedItems: List<RadioButtonFieldState<T>>.from(items),
    items: Future.value(items),
  );

  state = state.copyWith(fields: Map.from(state.fields));
}