Mutation<T, V> class

Manages the state and lifecycle of a data mutation (e.g., POST, PUT, DELETE).

This class handles optimistic updates, error handling, and query invalidation.

Constructors

Mutation({required MutationFetcher<T, V> mutationFn, required QueryCache cache, required QueryClient queryClient, MutationConfig<T, V> config = const MutationConfig()})
Creates a Mutation instance.

Properties

config MutationConfig<T, V>
Configuration options for this specific mutation.
final
hashCode int
The hash code for this object.
no setterinherited
mutationFn MutationFetcher<T, V>
The function responsible for executing the mutation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state MutationState<T>
Gets the current state of the mutation.
no setter
stateStream Stream<MutationState<T>>
Exposes the stream of mutation state changes.
no setter

Methods

dispose() → void
Disposes the mutation's resources.
mutate(V variables) Future<T>
Executes the mutation with the given variables.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the mutation's state to idle.
toString() String
A string representation of this object.
inherited

Operators

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