updateState method
updateState Updates the state and notifies listeners if the value has changed.
Implementation
@override
void updateState(T newState) {
if (notifier != newState) {
// Prevent circular update
if (_updatingNotifiers.contains(this)) {
return;
}
// Check for possible notification overflow
_checkNotificationOverflow();
assert(() {
log('📝 Updating state for $T: $notifier -> ${newState.runtimeType}',
level: 10);
return true;
}());
_updatingNotifiers.add(this);
try {
// Update value and notify
super.updateState(newState);
// Notify parents if they exist
if (_parents.isNotEmpty) {
assert(() {
log('📤 Notifying parent states for $T', level: 10);
return true;
}());
for (var parent in _parents) {
parent.notifyListeners();
}
}
} finally {
_updatingNotifiers.remove(this);
}
}
}