EventChannel<T> class final

A buffered event channel with independent readers.

Unread events remain for retainedUpdates updates. Use null to keep them until every reader consumes them.

Constructors

EventChannel({int? retainedUpdates = 8})
Creates a channel that keeps unread events for at most retainedUpdates calls to update, or indefinitely when retainedUpdates is null.

Properties

hashCode int
The hash code for this object.
no setterinherited
hasReaders bool
Whether the channel has readers.
no setter
isEmpty bool
Whether the channel buffers no events. See isNotEmpty.
no setter
isNotEmpty bool
Whether the channel contains events.
no setter
pendingCount int
Number of buffered events.
no setter
readerLagged bool
Whether a reader lost events during the last update.
no setter
retainedUpdates int?
How many maintenance passes an unread event survives, or null for unbounded retention.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Discards every buffered event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reader() EventReader<T>
Creates a reader positioned at the current end (it will only observe events sent after this call).
readerFromStart() EventReader<T>
Creates a reader at the oldest buffered event.
send(T event) → void
Appends an event to the channel.
sendDynamic(Object event) → void
Adds event using its runtime type.
toString() String
A string representation of this object.
inherited
update() int
Removes consumed and expired events.
writer() EventWriter<T>
Creates a writer bound to this channel.

Operators

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