getChangePayload method

  1. @override
Object? getChangePayload(
  1. int oldItemPosition,
  2. int newItemPosition
)
override

When areItemsTheSame(int, int) returns true for two items and areContentsTheSame(int, int) returns false for them, DiffUtil calls this method to get a payload about the change.

Default implementation returns {@code null}.

@param oldItemPosition The position of the item in the old list @param newItemPosition The position of the item in the new list

@return A payload object that represents the change between the two items.

Implementation

@override
Object? getChangePayload(int oldItemPosition, int newItemPosition) {
  return null;
}