replaceLocally method

void replaceLocally(
  1. bool indexWhere(
    1. T oldItem
    ),
  2. T item
)

Implementation

void replaceLocally(
  bool Function(T oldItem) indexWhere,
  T item,
) {
  final data = [...(state.data ?? <T>[])];
  final index = data.indexWhere(indexWhere);

  if (index != -1) {
    data[index] = item;
    _emitUpdatedData(data);
  }
}