ResponseStream class

A streaming response with event-based callbacks.

Similar to OpenAI SDK's ResponseStream pattern:

final runner = client.responses.stream(request)
  ..onEvent((event) => print('Event: $event'))
  ..onTextDelta((delta) => stdout.write(delta));

await for (final event in runner) {
  // Process events
}

final response = await runner.finalResponse;

Constructors

ResponseStream(Stream<StreamingEvent> _stream)
Creates a ResponseStream.

Properties

finalResponse Future<ResponseResource?>
Get the final completed response after stream completes.
no setter
hashCode int
The hash code for this object.
no setterinherited
outputText Future<String?>
Get the output text from the final response.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text Future<String>
Get all accumulated text after stream completes.
no setter

Methods

asStream() Stream<StreamingEvent>
Iterate through all events while executing callbacks.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onEvent(void callback(StreamingEvent event)) → void
Register callback for all events.
onFunctionCallDelta(void callback(String delta)) → void
Register callback for function call argument delta events.
onReasoningDelta(void callback(String delta)) → void
Register callback for reasoning delta events.
onTextDelta(void callback(String delta)) → void
Register callback for text delta events only.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited