updateShouldNotifyDependent method

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

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

Implementation

@override
bool updateShouldNotifyDependent(StageData oldWidget, Set<Object> dependencies) {
  final tag = _builtScene.tag;
  final oldTag = oldWidget._builtScene.tag;
  final tagStates = _builtTagStates;
  final oldTagStates = oldWidget._builtTagStates;
  final interacting = _builtStance.interacting;
  final oldInteracting = oldWidget._builtStance.interacting;
  for (final dep in dependencies) {
    switch (dep) {
      case _tagAspect:
        if (tag != oldTag) return true;
      case _widgetAspect:
        if (_builtScene.widget != oldWidget._builtScene.widget) return true;
      case _hasWidgetAspect:
        if ((_builtScene.widget != null) != (oldWidget._builtScene.widget != null)) return true;
      case _dismissingAspect:
        if (_builtStance.dismissing != oldWidget._builtStance.dismissing) return true;
      case _interactingAspect:
        if (interacting != oldInteracting) return true;
      case (#tag, final Object t):
        final was = oldTag == t || oldTagStates.containsKey(t);
        final now = tag == t || tagStates.containsKey(t);
        if (was != now) return true;
      case (#active, final Object t):
        if ((tag == t) != (oldTag == t)) return true;
      case (#state, final Object t):
        if (tagStates[t] != oldTagStates[t]) return true;
      case (#interacting, final Object t):
        final was = oldTag == t && oldInteracting;
        final now = tag == t && interacting;
        if (was != now) return true;
    }
  }
  return false;
}