Content extension type

Could be either TextContent, ImageContent, AudioContent, EmbeddedResource or ResourceLink.

Use isText, isImage, isAudio, isEmbeddedResource and isResourceLink 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
Whether or not this is a ResourceLink.
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, Meta? meta, required String mimeType})
Alias for AudioContent.new.
embeddedResource → const EmbeddedResource Function({Annotations? annotations, Meta? meta, required ResourceContents resource})
Alias for EmbeddedResource.new.
image → const ImageContent Function({Annotations? annotations, required String data, Meta? meta, required String mimeType})
Alias for ImageContent.new.
Alias for ResourceLink.new.
text → const TextContent Function({Annotations? annotations, Meta? meta, required String text})
Alias for TextContent.new.