copyWith method

QueryState<T> copyWith({
  1. QueryStatus? status,
  2. T? data,
  3. dynamic error,
  4. DateTime? dataUpdatedAt,
  5. DateTime? errorUpdatedAt,
  6. bool? isFetching,
})

Creates a copy of the query state with the given fields replaced with the new values.

Implementation

QueryState<T> copyWith({
  QueryStatus? status,
  T? data,
  dynamic error,
  DateTime? dataUpdatedAt,
  DateTime? errorUpdatedAt,
  bool? isFetching,
}) {
  return QueryState<T>(
    status: status ?? this.status,
    data: data ?? this.data,
    error: error ?? this.error,
    dataUpdatedAt: dataUpdatedAt ?? this.dataUpdatedAt,
    errorUpdatedAt: errorUpdatedAt ?? this.errorUpdatedAt,
    isFetching: isFetching ?? this.isFetching,
  );
}