HostEventType enum

Defines message types for event streams inside host sockets

Usage example:


/// Event stream
final Stream<Map<HostEventType, dynamic>> eventStream;

/// Event stream controller
final StreamController<Map<HostEventType, dynamic>> eventStreamController;

/// Stream and controller initialization
eventStreamController = StreamController<Map<HostEventType, dynamic>>.
broadcast();
eventStream = eventStreamController.stream;

/// Send event and message to stream
void emit({required HostEventType message, dynamic body}) {
  eventStreamController.add({message: body});
}

/// Listen event and message
eventStream.listen((event) {
  if (event.containsKey(HostEventType.connection)) {
    var message = event.values.first;
    print(message);
  }
});

Inheritance

Constructors

HostEventType()
const

Values

ready → const HostEventType
connection → const HostEventType
error → const HostEventType
diagnostic → const HostEventType
close → const HostEventType

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Constants

values → const List<HostEventType>
A constant List of the values in this enum, in order of their declaration.