onQueryMoreComments method
void
onQueryMoreComments(
- PaginationResult<
CommentData> result, { - Filter<
Object> ? filter, - CommentsSort? sort,
Handles the result of a query for more comments.
Implementation
void onQueryMoreComments(
PaginationResult<CommentData> result, {
Filter? filter,
CommentsSort? sort,
}) {
_queryConfig = (filter: filter, sort: sort);
// Merge the new comments with the existing ones (keeping the sort order)
final updatedComments = state.comments.merge(
result.items,
key: (it) => it.id,
compare: commentSort.compare,
);
state = state.copyWith(
comments: updatedComments,
pagination: result.pagination,
);
}