StreamHandler class
Manages streaming AI responses with unified handling.
Provides utilities for:
- Accumulating text from chunks
- Timeout handling
- Error recovery
- Completion callbacks
Constructors
- StreamHandler({Duration? timeout})
Properties
Methods
-
accumulate(
Stream< AIStreamChunk> stream) → Stream<String> - Converts a stream of chunks into a stream of accumulated text.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
process(
Stream< AIStreamChunk> stream, {OnChunkCallback? onChunk, OnCompleteCallback? onComplete, OnStreamErrorCallback? onError}) → Future<String> - Processes a stream of chunks and returns the accumulated text.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited