copyWith method

ApiResponse<T> copyWith({
  1. T? data,
  2. dynamic raw,
  3. ResponseStatus? status,
  4. ApiException? error,
  5. int? statusCode,
  6. Map<String, dynamic>? headers,
  7. String? message,
  8. Duration? duration,
})

Copy with new values

Implementation

ApiResponse<T> copyWith({
  T? data,
  dynamic raw,
  ResponseStatus? status,
  ApiException? error,
  int? statusCode,
  Map<String, dynamic>? headers,
  String? message,
  Duration? duration,
}) {
  return ApiResponse<T>(
    data: data ?? this.data,
    raw: raw ?? this.raw,
    status: status ?? this.status,
    error: error ?? this.error,
    statusCode: statusCode ?? this.statusCode,
    headers: headers ?? this.headers,
    message: message ?? this.message,
    duration: duration ?? this.duration,
  );
}