autoDispose method
void
autoDispose(
- void cleanup()
Registers a custom cleanup callback to run when this controller is disposed.
Useful for closing streams, timers, or unregistering platform listeners.
Implementation
void autoDispose(void Function() cleanup) {
if (_isDisposed) return;
_disposers.add(cleanup);
}