copyWith method

ResourceSnapshot<T> copyWith({
  1. ResourceStatus? status,
  2. T? data,
  3. Object? error,
  4. DateTime? updatedAt,
  5. bool clearError = false,
})

Creates a modified snapshot.

Implementation

ResourceSnapshot<T> copyWith({
  ResourceStatus? status,
  T? data,
  Object? error,
  DateTime? updatedAt,
  bool clearError = false,
}) {
  return ResourceSnapshot<T>(
    status: status ?? this.status,
    data: data ?? this.data,
    error: clearError ? null : error ?? this.error,
    updatedAt: updatedAt ?? this.updatedAt,
  );
}