AlphaXSseParser class final
Incrementally parses an AlphaX response body as Server-Sent Events.
Use it directly on an AlphaX response stream:
await for (final event in response.stream.transform(AlphaXSseParser())) {
print(event.data);
}
Input is decoded as strict UTF-8. Dart's streaming decoder retains an incomplete multibyte code point between source chunks. The parser recognizes LF, CRLF, and CR line endings, including a CRLF split across chunks.
The default one-megabyte line and eight-megabyte event-data limits are deliberately generous while preventing an endless line or data block from growing memory without bound. A limit violation emits FormatException and terminates the parsed stream. The UTF-8 decoder itself buffers at most the incomplete code point needed to complete the next character.
A stream ending without a terminating blank line does not dispatch its
incomplete event. A trailing CR is a line terminator and is processed before
the stream completes. The parser never reconnects and never sends
Last-Event-ID automatically.
- Inheritance
-
- Object
- StreamTransformerBase<
List< int> , AlphaXSseEvent> - AlphaXSseParser
Constructors
- AlphaXSseParser({int maxLineLength = 1024 * 1024, int maxEventDataLength = 8 * 1024 * 1024})
- Creates a parser with generous bounded line and event-data buffers.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxEventDataLength → int
-
Maximum number of Dart string code units buffered for one event's data,
including the newline separators inserted between
datafields.final - maxLineLength → int
-
Maximum number of Dart string code units allowed in one input line.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
bind(
Stream< List< stream) → Stream<int> >AlphaXSseEvent> -
Transforms the provided
stream.override -
cast<
RS, RT> () → StreamTransformer< RS, RT> -
Provides a
StreamTransformer<RS, RT>view of this stream transformer.inherited -
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