updateShouldNotifyDependent method

  1. @override
bool updateShouldNotifyDependent(
  1. covariant SharedValueInheritedModel oldWidget,
  2. Set<int> dependencies
)
override

Return true if the changes between this model and oldWidget match any of the dependencies.

Implementation

@override
bool updateShouldNotifyDependent(
  SharedValueInheritedModel oldWidget,
  Set<int> dependencies,
) {
  // Compare the nonce value of this SharedValue,
  // with an older nonce value of the same SharedValue object.
  //
  // If the nonce values are not same,
  // rebuild the widget
  return dependencies.any(
    (sharedValueHash) =>
        stateNonceMap[sharedValueHash] !=
        oldWidget.stateNonceMap[sharedValueHash],
  );
}