updateById method

IList<T> updateById(
  1. Iterable<T> newItems,
  2. dynamic id(
    1. T item
    )
)

Returns a new list where newItems are added or updated, by their id (and the id is a function of the item), like so:

  1. Items with the same id will be replaced, in place.
  2. Items with new ids will be added go to the end of the list.

Note: If the original list contains more than one item with the same id as some item in newItems, the first will be replaced, and the others will be left untouched. If newItems contains more than one item with the same id, the last one will be used, and the previous discarded.

Implementation

IList<T> updateById(
  Iterable<T> newItems,
  dynamic Function(T item) id,
) =>
    IList._unsafeFromList(_l.updateById(newItems, id), config: config);