copyWith method

Response copyWith({
  1. String? body,
  2. int? statusCode,
  3. BaseRequest? request,
  4. Map<String, String>? headers,
  5. bool? isRedirect,
  6. bool? persistentConnection,
  7. String? reasonPhrase,
})

Creates a new instance of Response based of on this. It copies all the properties and overrides the ones sent via parameters.

Implementation

Response copyWith({
  String? body,
  int? statusCode,
  BaseRequest? request,
  Map<String, String>? headers,
  bool? isRedirect,
  bool? persistentConnection,
  String? reasonPhrase,
}) =>
    Response(
      body ?? this.body,
      statusCode ?? this.statusCode,
      request: request ?? this.request,
      headers: headers ?? this.headers,
      isRedirect: isRedirect ?? this.isRedirect,
      persistentConnection: persistentConnection ?? this.persistentConnection,
      reasonPhrase: reasonPhrase ?? this.reasonPhrase,
    );