copyWith method
- String? endpoint,
- String? method,
- Map<
String, dynamic> ? query, - Map<
String, String> ? headers, - RequestBody? body,
- ResponseTypeHint? responseType,
Returns a copy of this request with selected fields replaced.
Passing null for query or headers preserves the current value.
Implementation
HttpRequest copyWith({
String? endpoint,
String? method,
Map<String, dynamic>? query,
Map<String, String>? headers,
RequestBody? body,
ResponseTypeHint? responseType,
}) {
return HttpRequest(
endpoint: endpoint ?? this.endpoint,
method: method ?? this.method,
query: query ?? this.query,
headers: headers ?? this.headers,
body: body ?? this.body,
responseType: responseType ?? this.responseType,
);
}