Content extension type

Could be either TextContent, ImageContent, AudioContent or EmbeddedResource.

Use isText, isImage and isEmbeddedResource before casting to the more specific types, or switch on the type and then cast.

Doing is checks does not work because these are just extension types, they all have the same runtime type (Map<String, Object?>).

on
Implementers

Constructors

Content.fromMap(Map<String, Object?> value)
factory

Properties

isAudio bool
Whether or not this is an AudioContent.
no setter
isEmbeddedResource bool
Whether or not this is an EmbeddedResource.
no setter
isImage bool
Whether or not this is an ImageContent.
no setter
isText bool
Whether or not this is a TextContent.
no setter
type String
The type of content.
no setter

Constants

audio → const AudioContent Function({Annotations? annotations, required String data, required String mimeType})
Alias for AudioContent.new.
embeddedResource → const EmbeddedResource Function({Annotations? annotations, required Content resource})
Alias for EmbeddedResource.new.
image → const ImageContent Function({Annotations? annotations, required String data, required String mimeType})
Alias for ImageContent.new.
text → const TextContent Function({Annotations? annotations, required String text})
Alias for TextContent.new.