maybeNotifyGraphChange method
Notifies observers of a graph change only if the dependencies have actually changed.
Implementation
void maybeNotifyGraphChange(Iterable<LxReactive> reactives) {
if (reactives.isEmpty) return;
int hash = 0;
int length = 0;
for (final r in reactives) {
hash ^= identityHashCode(r);
length++;
}
if (hash == _lastReactivesHash && length == _lastReactivesLength) {
return;
}
_lastReactivesHash = hash;
_lastReactivesLength = length;
// Reuse list if input is already a List, otherwise cache the conversion
if (reactives is List<LxReactive>) {
_cachedReactivesList = reactives;
} else {
_cachedReactivesList = reactives.toList(growable: false);
}
LevitStateMiddlewareChain.applyGraphChange(this, _cachedReactivesList!);
}