addOnLastListenerRemovedCallback method

void addOnLastListenerRemovedCallback (
  1. VoidCallback callback
)

Adds a callback to call when removeListener results in an empty list of listeners.

This callback will never fire if removeListener is never called.

Implementation

void addOnLastListenerRemovedCallback(VoidCallback callback) {
  assert(callback != null);
  _onLastListenerRemovedCallbacks.add(callback);
}