addOnLastListenerRemovedCallback method

void addOnLastListenerRemovedCallback(
  1. VoidCallback callback
)

Adds a callback to call when removeListener results in an empty list of listeners and there are no keepAlive handles outstanding.

This callback will never fire if removeListener is never called.

Implementation

void addOnLastListenerRemovedCallback(VoidCallback callback) {
  _checkDisposed();
  _onLastListenerRemovedCallbacks.add(callback);
}