didUpdateProvider method

  1. @override
  2. @mustCallSuper
void didUpdateProvider(
  1. ProviderBase<Object?> provider,
  2. Object? previousValue,
  3. Object? newValue,
  4. ProviderContainer container,
)

Called by providers when they emit a notification.

  • newValue will be null if the provider threw during initialization.
  • previousValue will be null if the previous build threw during initialization.

Implementation

@override
@mustCallSuper
void didUpdateProvider(
  ProviderBase<Object?> provider,
  Object? previousValue,
  Object? newValue,
  ProviderContainer container,
) {
  super.didUpdateProvider(provider, previousValue, newValue, container);
  if (!settings.enabled || !settings.printProviderUpdated) {
    return;
  }
  final accepted = settings.providerFilter?.call(provider) ?? true;
  if (!accepted) {
    return;
  }
  _talker.logCustom(
    RiverpodUpdateLog(
      provider: provider,
      previousValue: previousValue,
      newValue: newValue,
      settings: settings,
    ),
  );
}