updateShouldNotifyDependent method
bool
updateShouldNotifyDependent(
- covariant LLContentModel old,
- Set<
LLAspect> dependencies
override
Return true if the changes between this model and oldWidget match any
of the dependencies.
Implementation
@override
bool updateShouldNotifyDependent(
LLContentModel old, Set<LLAspect> dependencies) {
// A language or release change is an UNCONDITIONAL broadcast: an atomic
// swap changes every segment at once, so comparing per-segment state would
// miss it whenever two releases happen to leave a segment in the same
// state.
if (old.language != language ||
old.releaseSeq != releaseSeq ||
old.manifestHash != manifestHash) {
return true;
}
for (final LLAspect aspect in dependencies) {
final bool changed = switch (aspect) {
_AnyAspect() => old.version != version,
_LanguageAspect() => old.requestedLanguage != requestedLanguage,
_DirectionAspect() => old.direction != direction,
_ReleaseAspect() => old.source != source,
_StatusAspect() => old.status.version != status.version,
_FontAspect() =>
old.fontFamily != fontFamily || old.fontState != fontState,
// Covered by the manifest-hash check above; a new language list cannot
// arrive without a new release.
_LanguagesAspect() => false,
LLSegmentAspect(:final String name) =>
old.segmentStates[name] != segmentStates[name],
};
if (changed) return true;
}
return false;
}