Event<P> class

Constructors

Event({String name = 'event', int historyLimit = -1})
New event of payload type P with name

Properties

hashCode int
The hash code for this object.
no setterinherited
history List<P>
no setter
historyLength int
no setter
historyLimit int
if value is 0 then no history limit if value is -1 then no history if value is > 0 then history limit
final
lastPayload → P?
get the latest payload if exists else returns null
no setter
listenersCount int
no setter
name String
event name
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addFilteredListener(EventListener<P> listener, ListenerFilter<P> filter, {bool useHistory = true}) ListenerKiller
the same as addListener but will call listener only if filter returns true
addListener(EventListener<P> listener, {bool useHistory = true}) ListenerKiller
add listener to listeners
addTypedListener<T extends P>(EventListener<T> listener, {bool useHistory = true, bool useRuntimeType = false, List<Type>? excludedTypes}) ListenerKiller
the same as addListener but will call listener only if payload type is T which is a subtype of P
clear([bool filter(EventListener<P> listener)?]) → void
clear listeners list
clearHistory() → void
clear payloads history
fire(P payload, {bool useHistory = true, Duration? delay, bool silent = false}) → void
Fire the payload to all listeners.
linkTo<R>(Event<R> event, PayloadConverter<P, R> converter, {bool useHistory = true, Duration? delay, bool silent = false}) ListenerKiller
add listener with converter callback to convert payload of type P to payload of type R then fires the new payload using event
listenTo(Event<P> event, {bool useHistory = true, Duration? delay, bool silent = false}) ListenerKiller
listens to another Event of the same type
loop() → void
call all listeners with the payloads queue
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify([Duration? delay]) → void
fires a null payload without using history
onNext([int? ignoreCount]) Future<P>
returns future that completes on next fire
removeListener(EventListener<P> listener) → void
remove listener
toString() String
A string representation of this object.
inherited

Operators

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