UserMessage class final

A message authored by the user.

Ported from pi's UserMessage. content is either a plain String or a List<ContentBlock> containing TextContent and/or ImageContent, mirroring pi's string | (TextContent | ImageContent)[].

Implemented types

Constructors

UserMessage({required Object content, required DateTime timestamp})
const
UserMessage.fromJson(Map<String, dynamic> json)
Deserializes from a JSON map produced by toJson.
factory
UserMessage.text(String text, {DateTime? timestamp})
Convenience constructor for a plain-text user message.

Properties

content → Object
Plain text, or content blocks (text and images).
final
hashCode → int
The hash code for this object.
no setterinherited
role → String
The role discriminator: user, assistant, or toolResult.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timestamp → DateTime
When this message was created.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Serializes to a JSON map with a role discriminator (pi shape).
override
toString() → String
A string representation of this object.
inherited

Operators

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