updateItemAt method

  1. @override
void updateItemAt(
  1. int index,
  2. T updatedItem
)
override

Update a specific item in the list at the given index

Implementation

@override
void updateItemAt(int index, T updatedItem) {
  final items = state.itemList ?? [];
  if (index >= 0 && index < items.length) {
    final updatedItemList = List<T>.from(items); // Copy the list
    updatedItemList[index] = updatedItem; // Update the item at the given index

    state = state.copyWith(
      itemList: updatedItemList,
      nextPageKey: state.nextPageKey,
      error: state.error,
    );
  }
}