hasEventListener method

bool hasEventListener (String eventType, { bool useCapture: false })

Returns true if the EventDispatcher has event listeners. The useCapture paramenter defines if the event listeners should be registered for the capturing event phase or not.

Implementation

bool hasEventListener(String eventType, {bool useCapture = false}) {
  var eventStreams = _eventStreams;
  if (eventStreams == null) return false;
  var eventStream = eventStreams[eventType];
  if (eventStream == null) return false;

  return useCapture
      ? eventStream.hasCapturingSubscriptions
      : eventStream.hasBubblingSubscriptions;
}