notifyDependent method Null safety

  1. @override
void notifyDependent(
  1. covariant InheritedModel<T> oldWidget,
  2. Element dependent
)
override

Called by notifyClients for each dependent.

Calls dependent.didChangeDependencies() by default.

Subclasses can override this method to selectively call didChangeDependencies based on the value of getDependencies.

See also:

Implementation

@override
void notifyDependent(InheritedModel<T> oldWidget, Element dependent) {
  final Set<T>? dependencies = getDependencies(dependent) as Set<T>?;
  if (dependencies == null) {
    return;
  }
  if (dependencies.isEmpty || (widget as InheritedModel<T>).updateShouldNotifyDependent(oldWidget, dependencies)) {
    dependent.didChangeDependencies();
  }
}