copyWith method

HttpRequest copyWith({
  1. String? endpoint,
  2. String? method,
  3. Map<String, dynamic>? query,
  4. Map<String, String>? headers,
  5. RequestBody? body,
  6. 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,
  );
}