mutationSuccess method

  1. @override
  2. @mustCallSuper
void mutationSuccess(
  1. ProviderObserverContext context,
  2. Mutation<Object?> mutation,
  3. Object? result
)

A mutation succeeded.

result is the value returned by the mutation.

mutation is strictly the same as ProviderObserverContext.mutation. It is provided as a convenience, as this life-cycle is guaranteed to have a non-null ProviderObserverContext.mutation.

Implementation

@override
@mustCallSuper
void mutationSuccess(
  ProviderObserverContext context,
  Mutation<Object?> mutation,
  Object? result,
) {
  super.mutationSuccess(context, mutation, result);

  if (!settings.enabled || !settings.printMutationSuccess) return;

  final accepted = settings.providerFilter?.call(context.provider) ?? true;
  if (!accepted) return;

  _talker.logCustom(
    RiverpodMutationSuccessLog(
      provider: context.provider,
      mutation: mutation,
      result: result,
      settings: settings,
    ),
  );
}