AIAssistantElement class
Represents a single element in the ordered content blocks of an AI Assistant message.
Each element corresponds to one entry in data.elements — an ordered array
of typed block objects that the renderer walks left-to-right to combine/render
the assistant message content.
The SDK never parses data — it returns the raw value as-is; the caller
branches on getType() to decide how to render getData().
Element types:
"text"→ getData() returns the text string for that block."card"→ getData() returns{ "card": { …raw card payload… }, "cardId": "<uuid>" }.- Other types (e.g.
"graph") → getData() returns that type's raw JSON value.
Android Reference: com.cometchat.chat.models.AIAssistantElement
Constructors
- AIAssistantElement({String? type, dynamic data})
- Constructs an AIAssistantElement.
-
AIAssistantElement.fromMap(Map<
String, dynamic> map) -
Creates an AIAssistantElement from a map representing one entry
in the
data.elementsarray:{ "type": <string>, "value": <payload> }.factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getData(
) → dynamic -
Returns the element's body data — the raw
valuefrom the entry. -
getType(
) → String? - Returns the element's type string ("text", "card", "graph", …).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this element to a JSON-serializable map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override