MutationFunctionContext<TOnMutateResult> class
final
What a MutationFnWithContext is told about the run it is part of.
client, meta and mutationKey describe the mutation, as in TanStack
Query's MutationFunctionContext. This package adds two more:
- onMutateResult — after an optimistic patch the cache no longer says
what was there before; whatever
onMutatekept does, and a function that diffs "before" against "wanted" needs it. - signal — cancelled by
Mutation.cancel, so a transport that can abort does. A function that ignores it runs on, and its result is discarded.
- Annotations
Properties
- client → QueryClient
-
The client the mutation belongs to — handy for reading or writing the
query cache from inside the function.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- meta → Object?
-
The mutation's MutationOptions.meta, after the client's defaults
were applied;
nullwhen none was set anywhere.final - mutationKey → QueryKey?
-
The mutation's MutationOptions.mutationKey, or
nullfor an unkeyed mutation.final - onMutateResult → TOnMutateResult?
-
What
onMutatereturned for this run —nullwhen there is noonMutate, and for a restored mutation whatever was restored.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signal → QueryCancelToken
-
Cancelled by
cancel()— on the mutation, its observer or a controller — and by nothing else. One token for the whole run: a cancelled mutation does not retry. Removing the mutation from the cache or disposing what watches it does not cancel it: an attempt in flight is left to settle, so there is nothing to abort.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited