StreamPart class sealed
A single chunk in the stream returned by stream_text. Mirrors
StreamPart.ts (aimux-core/src/stream_part.rs).
StreamPart is an externally-tagged union: each part is a single-key map
like {"TextDelta": {"id": "...", "delta": "..."}}. Modeled as a sealed
class hierarchy so callers get compile-time types: every known variant is a
typed subclass with named fields, and StreamPartUnknown is the fallback
for tags added by newer core versions.
Known variants: StreamPartTextStart/StreamPartTextDelta/StreamPartTextEnd,
StreamPartStreamStart, StreamPartFinish, StreamPartError,
StreamPartToolInputStart/StreamPartToolInputDelta/StreamPartToolInputEnd,
StreamPartToolCall, StreamPartToolResult, StreamPartFile,
StreamPartReasoningStart/StreamPartReasoningDelta/StreamPartReasoningEnd,
StreamPartResponseMetadata, StreamPartSource, StreamPartRaw. Narrow
via switch/is/whereType to read variant-specific fields.
- Implementers
- StreamPartError
- StreamPartFile
- StreamPartFinish
- StreamPartRaw
- StreamPartReasoningDelta
- StreamPartReasoningEnd
- StreamPartReasoningStart
- StreamPartResponseMetadata
- StreamPartSource
- StreamPartStreamStart
- StreamPartTextDelta
- StreamPartTextEnd
- StreamPartTextStart
- StreamPartToolCall
- StreamPartToolInputDelta
- StreamPartToolInputEnd
- StreamPartToolInputStart
- StreamPartToolResult
- StreamPartUnknown
Constructors
-
StreamPart.fromJson(Map<
String, dynamic> json) -
Decode an externally-tagged stream-part map. Unknown tags fall back to
StreamPartUnknown instead of throwing.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
The variant tag — the single top-level key on the wire (e.g.
'TextDelta','ToolCall','ToolResult','File','Finish','Error'). Empty only for a malformed part.no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Re-encode to the externally-tagged wire shape (
{tag: payload}). -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited