GenerateResult<Output> class final

The result of generate: the final model response plus the parsed output, the full conversation messages, and the originating request.

A read-only view over modelResponse, deliberately not a wire-type subtype: the wire types have setters, and writing through them would not update this view's derived getters. Use modelResponse where a ModelResponse is expected.

Constructors

GenerateResult(ModelResponse _response, {ModelRequest? request, Output? output, Object? cause})

Properties

cause → Object?
The original thrown error a failed response resolved from, for callers that want to inspect the raw exception (e.g. cause is SocketException). The serializable view lives on error; cause is in-process only and does NOT survive the reflection/HTTP boundary (like modelRequest).
final
custom → Map<String, dynamic>?
Provider-specific data attached to the response.
no setter
error → RuntimeError?
The structured error of a failed response (finishReason: failed); null on success.
no setter
finishMessage → String?
A human-readable explanation of finishReason, if the model gave one.
no setter
finishReason → FinishReason
Why the model stopped generating.
no setter
hashCode → int
The hash code for this object.
no setterinherited
interrupts → List<ToolRequestPart>
The list of tool requests that triggered an interrupt.
no setter
latencyMs → double?
How long the model call took, in milliseconds.
no setter
media → Media?
The media content of the response.
no setter
message → Message?
The model's reply, or null when the turn produced none (e.g. aborted).
no setter
messages → List<Message>
The full history of the conversation, including the request messages and the final model response.
no setter
modelRequest → ModelRequest?
The request sent to the model on the final turn, when known.
no setter
modelResponse → ModelResponse
The underlying wire response, as returned by the model.
no setter
operation → Operation?
The long-running operation started by the model, if any.
no setter
output → Output?
The structured output, parsed with the output schema when one was given.
final
raw → Map<String, dynamic>?
The provider's raw response payload, if the plugin attached it.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text → String
The text content of the response.
no setter
toolRequests → List<ToolRequest>
The tool requests in the response.
no setter
usage → GenerationUsage?
Token and media usage reported by the model.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
The wire JSON of modelResponse, valid against GenerateResponse (minus the legacy candidates), so a result can be returned from an untyped flow or passed to jsonEncode. output, modelRequest and cause are not included.
toString() → String
A string representation of this object.
override

Operators

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