GenerateContent class sealed

A content item in a GenerateResult. Mirrors GenerateContent.ts (aimux-core/src/result.rs).

Externally-tagged union — each item is a single-key map whose key is the variant tag and whose value is the variant payload. Modeled as a sealed class hierarchy so callers get compile-time types: every known variant is a typed subclass with named fields, and GenerateContentUnknown is the fallback for tags added by newer core versions so they pass through verbatim instead of crashing.

Known variants: GenerateContentText, GenerateContentToolCall, GenerateContentSource, GenerateContentReasoning, GenerateContentFile, GenerateContentToolResult. The File variant carries model-generated files (e.g. images or documents) as a FileData tagged union under data, alongside a media_type (there is no filename field). Narrow via switch/is/whereType to read variant-specific fields.

Implementers

Constructors

GenerateContent.fromJson(Map<String, dynamic> json)
Decode an externally-tagged content map. Unknown tags fall back to GenerateContentUnknown 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
tag String
The variant tag — the single top-level key on the wire, e.g. 'Text', 'ToolCall'. Useful for logging / generic dispatch.
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.
inherited

Operators

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