EventListener<CallbackDataT> class

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.

Constructors

EventListener(String? type, EventCallback<CallbackDataT> callback, {bool once = false, bool protected = false, EventCallbackAdd<CallbackDataT>? onAdd, EventCallbackRemove<CallbackDataT>? onRemove, EventCallbackCall<CallbackDataT>? onCall, EventCallbackCancel<CallbackDataT>? onCancel, bool cancelAdded = true})
Event Listener

Properties

callback → EventCallback<CallbackDataT>
final
canceled bool
no setter
dataType Type
final
hashCode int
The hash code for this object.
no setterinherited
onAdd ↔ EventCallbackAdd<CallbackDataT>?
getter/setter pair
onCall ↔ EventCallbackCall<CallbackDataT>?
getter/setter pair
onCancel ↔ EventCallbackCancel<CallbackDataT>?
getter/setter pair
once bool
final
onRemove ↔ EventCallbackRemove<CallbackDataT>?
getter/setter pair
protected bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String?
final

Methods

appendCallback({EventCallbackAdd<CallbackDataT>? onAdd, EventCallbackRemove<CallbackDataT>? onRemove, EventCallbackCall<CallbackDataT>? onCall, EventCallbackCancel<CallbackDataT>? onCancel}) → void
call<T extends Event>(T event) bool
Checks if the listener matches the event. If the event is valid, the callback will be called.
cancel() → void
Cancel the listener.
matches<T>([String? type, EventCallback<T>? callback]) bool
Checks if the listener matches the event type, data type and callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
validate<T extends Event>(T event) bool
Checks if the listener matches a given event.

Operators

operator ==(Object other) bool
The equality operator.
inherited