Skip to content

Commit

Permalink
Fixes new page requests happening before the end of the current frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdsonBueno committed Jan 8, 2021
1 parent 111e4a5 commit 55279c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/ui/paged_sliver_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ class _PagedSliverBuilderState<PageKeyType, ItemType>
final isBuildingTriggerIndexItem = index == newPageRequestTriggerIndex;

if (_hasNextPage && isBuildingTriggerIndexItem) {
_pagingController.notifyPageRequestListeners(_nextKey);
// Schedules the request for the end of this frame.
WidgetsBinding.instance.addPostFrameCallback((_) {
_pagingController.notifyPageRequestListeners(_nextKey);
});
_hasRequestedNextPage = true;
}
}
Expand Down

0 comments on commit 55279c4

Please sign in to comment.