ZenInfiniteQuery<T> constructor
ZenInfiniteQuery<T> ({
- required Object queryKey,
- required Future<
T> infiniteFetcher(- dynamic pageParam,
- ZenCancelToken cancelToken
- required dynamic getNextPageParam(
- T lastPage,
- List<
T> allPages
- dynamic getPreviousPageParam(
- T firstPage,
- List<
T> allPages
- dynamic initialPageParam,
- ZenQueryConfig? config,
- List<
T> ? initialData, - ZenScope? scope,
- bool autoDispose = true,
Implementation
ZenInfiniteQuery({
required super.queryKey,
required this.infiniteFetcher,
required this.getNextPageParam,
this.getPreviousPageParam,
this.initialPageParam,
super.config,
super.initialData,
super.scope,
super.autoDispose,
}) : _nextPageParam = initialPageParam,
_previousPageParam =
initialPageParam, // Initially same, logic corrects it
super(
// The main fetcher (for initial load/refetch)
fetcher: (token) async {
// Pass the token to the infinite fetcher
final firstPage = await infiniteFetcher(initialPageParam, token);
return [firstPage];
},
);