copyWith<NewBodyType> method

Response<NewBodyType> copyWith<NewBodyType>({
  1. BaseResponse? base,
  2. NewBodyType? body,
  3. Object? bodyError,
})

Makes a copy of this Response, replacing original values with the given ones. This method can also alter the type of the response body.

Implementation

Response<NewBodyType> copyWith<NewBodyType>({
  http.BaseResponse? base,
  NewBodyType? body,
  Object? bodyError,
}) =>
    Response<NewBodyType>(
      base ?? this.base,
      body ?? (this.body as NewBodyType?),
      error: bodyError ?? error,
    );