copyWith method

ClientResponse copyWith({
  1. int? statusCode,
  2. String? body,
  3. List<int>? bodyBytes,
  4. Map<String, String>? headers,
  5. String? requestUrl,
  6. String? method,
  7. int? requestDuration,
  8. bool? isFromCache,
})

Creates a copy of this response with optional modifications.

Implementation

ClientResponse copyWith({
  int? statusCode,
  String? body,
  List<int>? bodyBytes,
  Map<String, String>? headers,
  String? requestUrl,
  String? method,
  int? requestDuration,
  bool? isFromCache,
}) {
  return ClientResponse(
    statusCode: statusCode ?? this.statusCode,
    body: body ?? this.body,
    bodyBytes: bodyBytes ?? this.bodyBytes,
    headers: headers ?? this.headers,
    requestUrl: requestUrl ?? this.requestUrl,
    method: method ?? this.method,
    requestDuration: requestDuration ?? this.requestDuration,
    isFromCache: isFromCache ?? this.isFromCache,
  );
}