mutate<TParsed> method

Future<QueryResult<TParsed>> mutate<TParsed>(
  1. MutationOptions<TParsed> options
)

Implementation

Future<QueryResult<TParsed>> mutate<TParsed>(
    MutationOptions<TParsed> options) async {
  final result = await fetchQuery(_oneOffOpId, options);
  // once the mutation has been process successfully, execute callbacks
  // before returning the results
  final mutationCallbacks = MutationCallbackHandler<TParsed>(
    cache: cache,
    options: options,
    queryId: _oneOffOpId,
  );

  final callbacks = mutationCallbacks.callbacks;

  for (final callback in callbacks) {
    await callback(result);
  }

  /// wait until callbacks complete to rebroadcast
  maybeRebroadcastQueries();

  return result;
}