1+ import 'package:meta/meta.dart' ;
2+
13import 'default_query_options.dart' ;
24import 'infinite_query_function_context.dart' ;
35import 'network_mode.dart' ;
@@ -33,7 +35,12 @@ typedef PrevPageParamBuilder<TData, TPageParam> = TPageParam? Function(
3335 InfiniteData <TData , TPageParam > data,
3436);
3537
38+ /// Options for configuring an infinite query.
39+ ///
40+ /// Contains all configuration for fetching and caching paginated data,
41+ /// including the query function, page parameter handling, and refetch behavior.
3642class InfiniteQueryOptions <TData , TError , TPageParam > {
43+ /// Creates options for an infinite query.
3744 InfiniteQueryOptions (
3845 List <Object ?> queryKey,
3946 this .queryFn, {
@@ -57,25 +64,64 @@ class InfiniteQueryOptions<TData, TError, TPageParam> {
5764 this .meta,
5865 }) : queryKey = QueryKey (queryKey);
5966
67+ /// The key that uniquely identifies this query.
6068 final QueryKey queryKey;
69+
70+ /// The function that fetches a page of data.
6171 final InfiniteQueryFn <TData , TPageParam > queryFn;
72+
73+ /// The page parameter for the first page.
6274 final TPageParam initialPageParam;
75+
76+ /// Derives the next page parameter from the current data.
6377 final NextPageParamBuilder <TData , TPageParam > nextPageParamBuilder;
78+
79+ /// Derives the previous page parameter from the current data.
6480 final PrevPageParamBuilder <TData , TPageParam >? prevPageParamBuilder;
81+
82+ /// The maximum number of pages to keep in memory.
6583 final int ? maxPages;
84+
85+ /// Whether this query is enabled.
6686 final bool ? enabled;
87+
88+ /// The network connectivity mode for this query.
6789 final NetworkMode ? networkMode;
90+
91+ /// How long data is considered fresh before becoming stale.
6892 final StaleDuration ? staleDuration;
93+
94+ /// How long unused data remains in cache before garbage collection.
6995 final GcDuration ? gcDuration;
96+
97+ /// Placeholder data shown while the query is loading.
7098 final InfiniteData <TData , TPageParam >? placeholder;
99+
100+ /// Whether to refetch when an observer mounts.
71101 final RefetchOnMount ? refetchOnMount;
102+
103+ /// Whether to refetch when the app resumes from background.
72104 final RefetchOnResume ? refetchOnResume;
105+
106+ /// Whether to refetch when network connectivity is restored.
73107 final RefetchOnReconnect ? refetchOnReconnect;
108+
109+ /// Interval at which to automatically refetch.
74110 final Duration ? refetchInterval;
111+
112+ /// Retry behavior for failed fetches.
75113 final RetryResolver <TError >? retry;
114+
115+ /// Whether to retry a failed query when a new observer mounts.
76116 final bool ? retryOnMount;
117+
118+ /// Initial data to populate the cache before the first fetch.
77119 final InfiniteData <TData , TPageParam >? seed;
120+
121+ /// The timestamp when the seed data was last updated.
78122 final DateTime ? seedUpdatedAt;
123+
124+ /// Arbitrary metadata associated with this query.
79125 final Map <String , dynamic >? meta;
80126
81127 @override
@@ -147,6 +193,7 @@ class InfiniteQueryOptions<TData, TError, TPageParam> {
147193 'meta: $meta )' ;
148194}
149195
196+ @internal
150197extension InfiniteQueryOptionsExt <TData , TError , TPageParam >
151198 on InfiniteQueryOptions <TData , TError , TPageParam > {
152199 InfiniteQueryOptions <TData , TError , TPageParam > withDefaults (
0 commit comments