detachListener method

void detachListener({
  1. VoidCallback? listener,
})

remove a listener from the controller. @Params: listener is the listener to be removed. If no listener is passed, all listeners will be removed.

Implementation

void detachListener({VoidCallback? listener}) {
  if (listener != null) {
    _listeners.remove(listener);
  } else {
    _listeners.clear();
  }
}