AiPart class sealed

A single typed segment of an AiMessage.

A message is an ordered list of parts, mirroring the "parts" model used by modern AI SDKs: a turn may interleave prose, reasoning, tool calls and their results, files, and citations. AiPart is sealed, so a switch over a part is exhaustively checked at compile time — adding a new part type forces every consumer to handle it.

Every part serializes with a type discriminator. AiPart.fromJson dispatches on that field; subclasses round-trip their own payload.

See also AiMessage, which owns an ordered list of parts.

Constructors

AiPart.fromJson(Map<String, Object?> json)
Reconstructs a part from its json map by dispatching on type.
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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
Serializes this part, including its type discriminator.
toString() → String
A string representation of this object.
inherited

Operators

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