copyWith method

MutationState<TData, TError> copyWith({
  1. MutationStatus? status,
  2. TData? data,
  3. TError? error,
  4. bool clearError = false,
})

Creates a copy of this state with the given fields replaced.

Implementation

MutationState<TData, TError> copyWith({
  MutationStatus? status,
  TData? data,
  TError? error,
  bool clearError = false,
}) {
  return MutationState<TData, TError>(
    status: status ?? this.status,
    data: data ?? this.data,
    error: clearError ? null : (error ?? this.error),
  );
}