EventReader<T> class
final
A cursor-based reader over an EventChannel.
Each call to drain returns the events sent since the previous call and advances this reader's cursor to the channel's current end. Call dispose when finished so this reader stops retaining events and participating in channel maintenance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasUnread → bool
-
Whether unread events are available for this reader.
no setter
- isDisposed → bool
-
Whether this reader has been released. Disposal is idempotent.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
consume(
) → bool - Consumes unread events and reports whether any existed.
-
dispose(
) → void - Unregisters this reader and releases its reference to the channel. Subsequent reads throw StateError. Other readers are unaffected.
-
drain(
) → List< T> - Returns and consumes all events this reader has not yet seen.
-
forEach(
void callback(T event)) → void -
Invokes
callbackfor every unread event without allocating a result list, then advances this reader's cursor. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited