toWire function

Stream<Map<String, dynamic>> toWire(
  1. Stream<AgentEvent> events, {
  2. AgentWireProtocol? protocol,
})

Maps a live AgentEvent stream onto the wire. Unknown event kinds cannot occur here — the engine only emits native events.

Implementation

Stream<Map<String, dynamic>> toWire(
  Stream<AgentEvent> events, {
  AgentWireProtocol? protocol,
}) {
  final wire = protocol ?? AgentWireProtocol();
  return events.map(wire.encodeEvent);
}