NormalizedMessage class

A provider-agnostic representation of an AI model response message.

Normalizes the different response formats from Anthropic, OpenAI, Gemini, and other providers into a single consistent structure.

Constructors

NormalizedMessage({required String role, List<String> textParts = const [], List<String> thinkingParts = const [], List<Map<String, dynamic>> toolCalls = const [], String? rawProvider})
const

Properties

fullText → String
Returns all text parts joined as a single string.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasThinking → bool
Whether this message contains any thinking blocks.
no setter
hasToolCalls → bool
Whether this message contains any tool calls.
no setter
rawProvider → String?
The provider that generated this message, if known. Values: 'anthropic', 'openai', 'gemini', etc.
final
role → String
The role: 'user', 'assistant', 'system', or 'tool'.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textParts → List<String>
Extracted text content parts from the response.
final
thinkingParts → List<String>
Extracted thinking/reasoning parts (e.g., Anthropic's extended thinking).
final
toolCalls → List<Map<String, dynamic>>
Tool call blocks from the response.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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