dispose method
void
dispose()
Implementation
void dispose() {
if (_disposed) return;
_disposed = true;
if (strategy.controllerDispose) {
for (var c in controllers.values) {
try {
c.dispose();
} catch (e) {
// Controller already disposed, ignore
}
}
controllers.clear();
}
for (final sub in subscriptions) {
sub.cancel();
}
// Close all owned BehaviorSubjects to avoid leaks
for (final s in mapDropdownSubjects.values) {
s.close();
}
for (final s in mapMultiSelectSubjects.values) {
s.close();
}
for (final s in mapImageSubjects.values) {
s.close();
}
for (final s in mapMultiImageSubjects.values) {
for (final inner in (s.valueOrNull ?? const <BehaviorSubject<PicDataWrapper>>[])) {
inner.close();
}
s.close();
}
for (final s in mapArraySubjects.values) {
s.close();
}
for (final s in mapArrayCustomSubjects.values) {
s.close();
}
for (final s in mapCustomSubjects.values) {
s.close();
}
formMapOutput.close();
// Dispose focus nodes only if owned by the controller
for (final f in focusMap.values) {
if (f.$2 == true) {
f.$1.dispose();
}
}
}