copyWith method

HttpResponse copyWith({
  1. int? statusCode,
  2. Map<String, String>? headers,
  3. Object? data,
})

Returns a copy of this response with selected fields replaced.

Passing null for data preserves the current value.

Implementation

HttpResponse copyWith({
  int? statusCode,
  Map<String, String>? headers,
  Object? data,
}) {
  return HttpResponse(
    statusCode: statusCode ?? this.statusCode,
    headers: headers ?? this.headers,
    data: data ?? this.data,
  );
}