copyWith method
Creates a copy of this request with the given fields replaced with the new values. If no new value is given, the old value is used.
final original = ModelQueries.list(
Blog.classType,
);
final modified = original.copyWith(
document: yourCustomQuery,
);
Useful in advanced scenarios where you want to modify the request before sending it.
See https://docs.amplify.aws/lib/graphqlapi/advanced-workflows/q/platform/flutter/.
Implementation
GraphQLRequest<T> copyWith({
String? document,
String? apiName,
Map<String, String>? headers,
APIAuthorizationType? authorizationMode,
Map<String, dynamic>? variables,
String? decodePath,
ModelType? modelType,
}) {
return GraphQLRequest<T>(
document: document ?? this.document,
apiName: apiName ?? this.apiName,
headers: headers ?? this.headers,
authorizationMode: authorizationMode ?? this.authorizationMode,
variables: variables ?? this.variables,
decodePath: decodePath ?? this.decodePath,
modelType: modelType ?? this.modelType,
);
}