Skip to content

Sse

Category: LLM Providers

Source: sse.dart

Classes

SseEvent

A single Server-Sent Event.

Constructor

dart
SseEvent({this.event, required this.data})

Properties

PropertyTypeDescription
eventString?
dataString

Methods

String toString()

Functions

Stream<SseEvent> decodeSse(Stream<List<int>> bytes)

Decode a raw byte stream (from an HTTP response) into [SseEvent]s.

Follows the SSE specification:

  • Events are separated by blank lines.
  • Lines starting with : are comments (ignored).
  • data: [DONE] is treated as end-of-stream (OpenAI convention).
  • Multiple data: lines in one event are joined with newlines.

Released under the MIT License.