when change paging controller value with new PagingState instance but with the same itemList data PagingController notify the PagedListView to rebuild.
we must use Deep hash and Deep equality for itemList.
for example:
final List<AdModel> localAds = _repo.getLocalAds();
log("localAds hash: ${localAds.hashCode}"); // 224064484
final localPagingState = PagingState(
itemList: localAds,
nextPageKey: null,
error: null,
);
pagingController.value = localPagingState;
log("localPagingState hash: ${localPagingState.hashCode}"); // 929420513
final List<AdModel> remoteAds = _repo.getRemoteAds();
log("remoteAds hash: ${remoteAds.hashCode}"); // 88481478
final remotePagingState = PagingState(
itemList: remoteAds,
nextPageKey: null,
error: null,
);
pagingController.value = remotePagingState;
log("remotePagingState hash: ${remotePagingState.hashCode}"); // 804726218
assert(localAds == remoteAds); // this will pass
assert(localPagingState == remotePagingState); // this will fail
when change paging controller value with new
PagingState
instance but with the sameitemList
dataPagingController
notify thePagedListView
to rebuild. we must use Deep hash and Deep equality foritemList
. for example: