InfinitePageContext<TPageParam> constructor
InfinitePageContext<TPageParam> ({
- required QueryClient client,
- required QueryKey queryKey,
- required TPageParam pageParam,
- required FetchDirection direction,
- required QueryCancelToken signalProvider(),
- Object? meta,
Built by the library for each page; a page function receives one rather than constructing it.
Construct one directly to call a pageFn in a test. signalProvider
is called when the page function reads signal; hand it a token of
the test's own, and cancel that token to test cancellation:
final token = QueryCancelToken();
final page = await options.pageFn(InfinitePageContext(
client: QueryClient(),
queryKey: QueryKey(['feed']),
pageParam: 0,
direction: FetchDirection.forward,
signalProvider: () => token,
));
Implementation
InfinitePageContext({
required this.client,
required this.queryKey,
required this.pageParam,
required this.direction,
required QueryCancelToken Function() signalProvider,
this.meta,
}) : _signalProvider = signalProvider;