copy method

Response<T> copy({
  1. bool? isCancel,
  2. bool? isSuccessful,
  3. bool? isLoading,
  4. bool? isFailed,
  5. T? data,
  6. List<T>? result,
  7. String? message,
  8. String? error,
  9. dynamic snapshot,
  10. Status? status,
  11. String? tag,
})

Implementation

Response<T> copy({
  bool? isCancel,
  bool? isSuccessful,
  bool? isLoading,
  bool? isFailed,
  T? data,
  List<T>? result,
  String? message,
  String? error,
  dynamic snapshot,
  Status? status,
  String? tag,
}) {
  return Response<T>(
    isCancel: isCancel ?? this.isCancel,
    isLoading: isLoading ?? this.isLoading,
    isSuccessful: isSuccessful ??
        (result != null
            ? true
            : message != null
                ? true
                : this.isSuccessful),
    isFailed: isFailed ?? this.isFailed,
    data: data ?? this.data,
    result: result ?? this.result,
    snapshot: snapshot ?? this.snapshot,
    tag: tag ?? this.tag,
    message:
        message ?? (isSuccessful ?? false ? "Successful!" : this.message),
    error: error ?? this.error,
    status: status ??
        (result != null
            ? Status.ok
            : (snapshot != null
                ? Status.created
                : (message != null ? Status.notFound : this.status))),
  );
}