areItemsTheSame method

  1. @override
bool areItemsTheSame(
  1. int oldItemPosition,
  2. int newItemPosition
)
override

Called by the DiffUtil to decide whether two object represent the same Item.

For example, if your items have unique ids, this method should check their id equality.

@param oldItemPosition The position of the item in the old list @param newItemPosition The position of the item in the new list @return True if the two items represent the same object or false if they are different.

Implementation

@override
bool areItemsTheSame(int oldItemPosition, int newItemPosition) {
  return equalityChecker(oldList[oldItemPosition], newList[newItemPosition]);
}