after method
- K? key,
- C? cursor,
- int count
override
Fetches the Page after the provided key
or cursor
.
Implementation
@override
Future<Page<T, C>> after(K? key, C? cursor, int count) async {
// [_after] can be `null`, when there's no limit above the page.
if (_after != null) {
_after = _after! + count;
}
final int edgesBefore = _list.length;
final List<T> edges = await _page();
final bool fulfilled =
fulfilledWhenNone || _hasLast || edges.length - edgesBefore >= count;
Log.debug(
'after($key, $count) -> $fulfilled(${edges.length}), hasNext: ${!_hasLast}, hasPrevious: ${!_hasFirst}',
'$runtimeType',
);
_ensureLimits();
return Page(
fulfilled ? edges : [],
PageInfo(
hasNext: !_hasLast,
hasPrevious: !_hasFirst,
startCursor: _firstCursor,
endCursor: _lastCursor,
),
);
}