EventListener<CallbackDataT> constructor

EventListener<CallbackDataT>(
  1. String? type,
  2. EventCallback<CallbackDataT> callback, {
  3. bool once = false,
  4. bool protected = false,
  5. EventCallbackAdd<CallbackDataT>? onAdd,
  6. EventCallbackRemove<CallbackDataT>? onRemove,
  7. EventCallbackCall<CallbackDataT>? onCall,
  8. EventCallbackCancel<CallbackDataT>? onCancel,
  9. bool cancelAdded = true,
})

Event Listener

A listener is a subscription to a specific event type and data type.

This includes all the information needed for how to react with an event emitter.

Implementation

EventListener(
  this.type,
  this.callback, {
  this.once = false,
  this.protected = false,
  this.onAdd,
  this.onRemove,
  this.onCall,
  this.onCancel,
  bool cancelAdded = true,
}) {
  if (cancelAdded) {
    appendCallback(
      onAdd: (emitter) {
        appendCallback(
          onCancel: () => emitter.removeEventListener(this),
        );
      },
    );
  }
}