Segment class abstract

Base class for building event topic paths with chaining support.

Segments allow you to construct event topics by chaining method calls, making it easy to build complex event paths programmatically.

Example:

class UserSegment extends Segment {
  UserSegment() : super('user');
}

final userEvents = UserSegment();
userEvents.$('profile').$('update').emit<String>('John Doe');
Implementers

Constructors

Segment.new(String topic)
Creates a new segment with the given base topic.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
topic String
The current topic path being built.
getter/setter pair

Methods

$(String data) Segment
Appends a new segment to the current topic path.
emit<T>([T? data, bool retain = false]) → void
Emits an event on the current topic path.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<T>(EventCallback<T> callback) EventListener<T>
Registers a listener for events on the current topic path.
toString() String
A string representation of this object.
override
waitForData<T>() Future<T?>
Waits for a single event and returns the event data.
waitForEvent<T>(EventCallback<T> callback) Future<void>
Waits for a single event on the current topic path.

Operators

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