@@ -55,6 +55,37 @@ class QueryOptions<TParsed extends Object?> extends BaseOptions<TParsed> {
5555 onError,
5656 ];
5757
58+ /// Generic copyWith for all fields. There are other, more specific options:
59+ /// - [copyWithPolicies] and [withFetchMoreOptions]
60+ QueryOptions <TParsed > copyWithOptions ({
61+ DocumentNode ? document,
62+ String ? operationName,
63+ Map <String , dynamic >? variables,
64+ FetchPolicy ? fetchPolicy,
65+ ErrorPolicy ? errorPolicy,
66+ CacheRereadPolicy ? cacheRereadPolicy,
67+ Object ? optimisticResult,
68+ Duration ? pollInterval,
69+ Context ? context,
70+ ResultParserFn <TParsed >? parserFn,
71+ OnQueryComplete ? onComplete,
72+ OnQueryError ? onError,
73+ }) =>
74+ QueryOptions <TParsed >(
75+ document: document ?? this .document,
76+ operationName: operationName ?? this .operationName,
77+ variables: variables ?? this .variables,
78+ fetchPolicy: fetchPolicy ?? this .fetchPolicy,
79+ errorPolicy: errorPolicy ?? this .errorPolicy,
80+ cacheRereadPolicy: cacheRereadPolicy ?? this .cacheRereadPolicy,
81+ optimisticResult: optimisticResult ?? this .optimisticResult,
82+ pollInterval: pollInterval ?? this .pollInterval,
83+ context: context ?? this .context,
84+ parserFn: parserFn ?? this .parserFn,
85+ onComplete: onComplete ?? this .onComplete,
86+ onError: onError ?? this .onError,
87+ );
88+
5889 QueryOptions <TParsed > withFetchMoreOptions (
5990 FetchMoreOptions fetchMoreOptions,
6091 ) =>
@@ -190,6 +221,40 @@ class WatchQueryOptions<TParsed extends Object?> extends QueryOptions<TParsed> {
190221 carryForwardDataOnException,
191222 ];
192223
224+ /// Generic copyWith for all fields. There are other, more specific options:
225+ /// - [copyWithFetchPolicy] , [copyWithVariables] , etc
226+ WatchQueryOptions <TParsed > copyWith ({
227+ DocumentNode ? document,
228+ String ? operationName,
229+ Map <String , dynamic >? variables,
230+ FetchPolicy ? fetchPolicy,
231+ ErrorPolicy ? errorPolicy,
232+ CacheRereadPolicy ? cacheRereadPolicy,
233+ Object ? optimisticResult,
234+ Duration ? pollInterval,
235+ bool ? fetchResults,
236+ bool ? carryForwardDataOnException,
237+ bool ? eagerlyFetchResults,
238+ Context ? context,
239+ ResultParserFn <TParsed >? parserFn,
240+ }) =>
241+ WatchQueryOptions <TParsed >(
242+ document: document ?? this .document,
243+ operationName: operationName ?? this .operationName,
244+ variables: variables ?? this .variables,
245+ fetchPolicy: fetchPolicy ?? this .fetchPolicy,
246+ errorPolicy: errorPolicy ?? this .errorPolicy,
247+ cacheRereadPolicy: cacheRereadPolicy ?? this .cacheRereadPolicy,
248+ optimisticResult: optimisticResult ?? this .optimisticResult,
249+ pollInterval: pollInterval ?? this .pollInterval,
250+ fetchResults: fetchResults ?? this .fetchResults,
251+ eagerlyFetchResults: eagerlyFetchResults ?? this .eagerlyFetchResults,
252+ carryForwardDataOnException:
253+ carryForwardDataOnException ?? this .carryForwardDataOnException,
254+ context: context ?? this .context,
255+ parserFn: parserFn ?? this .parserFn,
256+ );
257+
193258 WatchQueryOptions <TParsed > copyWithFetchPolicy (
194259 FetchPolicy ? fetchPolicy,
195260 ) =>
0 commit comments