addAutoDisposeListener method
Add a listener to a Listenable object that is automatically removed when cancel is called.
Implementation
void addAutoDisposeListener(
Listenable? listenable, [
VoidCallback? listener,
String? id,
]) {
if (listenable == null || listener == null) return;
_listenables.add(listenable);
_listeners.add(listener);
listenable.addListener(listener);
if (id != null) {
_listenerIdExpando[listener] = id;
}
}