useInfiniteQuery<T, PageParam> function

UseInfiniteQuery<T, PageParam> useInfiniteQuery<T, PageParam>(
  1. List<Object> queryKey,
  2. Future<T> fetcher({
    1. PageParam? pageParam,
    }), {
  3. PageParam? getNextPageParam(
    1. T lastPage,
    2. List<T> allPages
    )?,
  4. PageParam? getPreviousPageParam(
    1. T lastPage,
    2. List<T> allPages
    )?,
  5. InfiniteQueryOptions<T, PageParam>? options,
  6. required Widget builder(
    1. BuildContext context,
    2. InfiniteQueryResult<T, PageParam> result
    ),
})

Convenience function to create UseInfiniteQuery widget

Implementation

UseInfiniteQuery<T, PageParam> useInfiniteQuery<T, PageParam>(
  List<Object> queryKey,
  Future<T> Function({PageParam? pageParam}) fetcher, {
  PageParam? Function(T lastPage, List<T> allPages)? getNextPageParam,
  PageParam? Function(T firstPage, List<T> allPages)? getPreviousPageParam,
  InfiniteQueryOptions<T, PageParam>? options,
  required Widget Function(
    BuildContext context,
    InfiniteQueryResult<T, PageParam> result,
  )
  builder,
}) {
  final queryOptions =
      options?.copyWith(
        queryKey: queryKey,
        queryFn: fetcher,
        getNextPageParam: getNextPageParam,
        getPreviousPageParam: getPreviousPageParam,
      ) ??
      InfiniteQueryOptions<T, PageParam>(
        queryKey: queryKey,
        queryFn: fetcher,
        getNextPageParam: getNextPageParam,
        getPreviousPageParam: getPreviousPageParam,
      );

  return UseInfiniteQuery<T, PageParam>(
    options: queryOptions,
    builder: builder,
  );
}