updateById method
Returns a new list where newItems
are added or updated, by their id
(and the id
is a function of the item), like so:
- Items with the same
id
will be replaced, in place. - Items with new
id
s 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);