updateShouldNotifyDependent method

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

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

Implementation

@override
bool updateShouldNotifyDependent(
  UiTheme oldWidget,
  Set<UiThemeAspect> dependencies,
) {
  final old = oldWidget.tokens;
  return dependencies.any(
    (aspect) => switch (aspect) {
      UiThemeAspect.colors => tokens.colors != old.colors,
      UiThemeAspect.spacing => tokens.spacing != old.spacing,
      UiThemeAspect.radius => tokens.radius != old.radius,
      UiThemeAspect.shadows => tokens.shadows != old.shadows,
      UiThemeAspect.typography => tokens.typography != old.typography,
      UiThemeAspect.motion => tokens.motion != old.motion,
      UiThemeAspect.effects => tokens.effects != old.effects,
      UiThemeAspect.brightness => tokens.brightness != old.brightness,
    },
  );
}