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);
}
});
Constructors
- HostEventType()
-
const
Values
- ready → const HostEventType
- connection → const HostEventType
- error → const HostEventType
- diagnostic → const HostEventType
- close → const HostEventType
Properties
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.