cleanupUnused method
void
cleanupUnused()
Cleanup unused state (removes all state - use with caution) Note: This removes all state regardless of listeners since hasListeners is not accessible from outside ChangeNotifier
Implementation
void cleanupUnused() {
// Note: We can't check hasListeners from outside, so this clears all state
// Use cleanupNamespace for more targeted cleanup
final keysToRemove = _state.keys.toList();
for (final key in keysToRemove) {
_state[key]?.dispose();
_state.remove(key);
}
}