contentAsString property
String
get
contentAsString
Returns to content of the message as a string.
Implementation
String get contentAsString => switch (this) {
final SystemChatMessage system => system.content,
final HumanChatMessage human => switch (human.content) {
final ChatMessageContentText text => text.text,
final ChatMessageContentImage image => image.data,
final ChatMessageContentMultiModal multiModal => multiModal.parts
.map(
(final p) => switch (p) {
final ChatMessageContentText text => text.text,
final ChatMessageContentImage image => image.data,
ChatMessageContentMultiModal _ => '',
},
)
.join('\n'),
},
final AIChatMessage ai => ai.content,
final ToolChatMessage tool => tool.content,
final CustomChatMessage custom => custom.content,
};