AssistMessage class
Represents a assist message.
The AssistMessage has two method constructor named AssistMessage.request and AssistMessage.response to store a message information such as message content, timestamp when the was sent, and the author details.
Example:
late List<AssistMessage> _messages;
@override
void initState() {
_messages = <AssistMessage>[
AssistMessage.response(
data: 'Hello, how can I help you today?',
),
];
super.initState();
}
@override
Widget build(BuildContext context) {
return SfAIAssistView(
messages: _messages,
actionButton: AssistActionButton(
onPressed: (String prompt) {
_messages.add(
AssistMessage.request(
data: prompt,
),
);
},
),
);
}
Constructors
- AssistMessage.request({required String data, DateTime? time, AssistMessageAuthor? author})
-
const
-
AssistMessage.response({required String data, DateTime? time, AssistMessageAuthor? author, List<
AssistMessageSuggestion> ? suggestions, AssistSuggestionSettings? suggestionSettings, List<AssistMessageToolbarItem> ? toolbarItems}) -
const
Properties
-
Author of the message.
final
- data → String
-
Content of the message.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRequested → bool
-
Decides whether the message is a request or not.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
suggestions
→ List<
AssistMessageSuggestion> ? -
Suggestions for the assist message.
final
- suggestionSettings → AssistSuggestionSettings?
-
Settings for the suggestions.
final
- text → String
-
Content of the message.
final
- time → DateTime?
-
Timestamp when the message was sent.
final
-
toolbarItems
→ List<
AssistMessageToolbarItem> ? -
Toolbar items for the assist message.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited