InfinitePageContext<TPageParam> constructor

InfinitePageContext<TPageParam>({
  1. required QueryClient client,
  2. required QueryKey queryKey,
  3. required TPageParam pageParam,
  4. required FetchDirection direction,
  5. required QueryCancelToken signalProvider(),
  6. 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;