MutationResult<TData, TError, TVariables, TOnMutateResult> class

The result of a mutation operation.

Contains the current state of a mutation including its data, error, and status flags. This is the primary type returned by mutation observers and provides both the mutation result and metadata about the mutation's lifecycle.

The type parameters are:

  • TData: The type of data returned by the mutation.
  • TError: The type of error that may occur during the mutation.
  • TVariables: The type of variables passed to the mutation function.
  • TOnMutateResult: The type of result returned by the onMutate callback.

Constructors

MutationResult({required MutationStatus status, required TData? data, required TError? error, required TVariables? variables, required DateTime? submittedAt, required int failureCount, required TError? failureReason, required bool isPaused, required Mutate<TVariables> mutate, required MutateAsync<TData, TVariables> mutateAsync, required Reset reset})
Creates a mutation result.
const

Properties

data → TData?
The last successfully resolved data for this mutation.
final
error → TError?
The error thrown by the last failed mutation, if any.
final
failureCount int
The number of times the current mutation has failed.
final
failureReason → TError?
The error from the most recent failed mutation attempt.
final
hashCode int
The hash code for this object.
no setteroverride
isError bool
Whether the mutation is in an error state.
no setter
isIdle bool
Whether the mutation has not been called yet.
no setter
isPaused bool
Whether the mutation is paused.
final
isPending bool
Whether the mutation is currently executing.
no setter
isSuccess bool
Whether the mutation completed successfully.
no setter
mutate → Mutate<TVariables>
A fire-and-forget function that executes the mutation.
final
mutateAsync → MutateAsync<TData, TVariables>
A function that executes the mutation and returns a Future with the result.
final
reset → Reset
Resets the mutation to its initial idle state.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status MutationStatus
The current status of the mutation.
final
submittedAt DateTime?
The timestamp when the mutation was submitted.
final
variables → TVariables?
The variables passed to the most recent mutate call.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override