combineList method
override
Combine the existing list (if available) with a new paged value.
By default, this function simply concats the new paged value to the existing list.
Subclasses can override this method to implement additional behavior such as avoiding duplicates in the combined list.
Implementation
@override
List<NotificationDTO> combineList(
List<NotificationDTO>? existing,
List<NotificationDTO> pageValue,
) {
// Filter duplicate notifications (based on id) when a new page is added
final existingIds = existing?.map((n) => n.id).toList() ?? [];
return [
...?existing,
...pageValue.where((n) => !existingIds.contains(n.id)),
];
}