addListener method

void addListener(
  1. ObjectEventListener listener
)

Register a listener that is called every time an object event is dispatched.

Listeners can be removed with removeListener.

Only call this when kFlutterMemoryAllocationsEnabled is true.

Implementation

void addListener(ObjectEventListener listener){
  if (!kFlutterMemoryAllocationsEnabled) {
    return;
  }
  if (_listeners == null) {
    _listeners = <ObjectEventListener?>[];
    _subscribeToSdkObjects();
  }
  _listeners!.add(listener);
}