Attachment class

The class that contains the information about an attachment

Available extensions
Annotations
  • @JsonSerializable(includeIfNull: false)

Constructors

Attachment.new({String? id, String? type, String? titleLink, String? title, String? thumbUrl, String? text, String? pretext, String? ogScrapeUrl, String? imageUrl, String? footerIcon, String? footer, dynamic fields, String? fallback, String? color, String? authorName, String? authorLink, String? authorIcon, String? assetUrl, List<Action>? actions = const [], int? originalWidth, int? originalHeight, Map<String, Object?> extraData = const {}, AttachmentFile? file, UploadState uploadState = const UploadState.preparing()})
Constructor used for json serialization
Attachment.fromData(Map<String, dynamic> json)
Create a new instance from a db data
factory
Attachment.fromJson(Map<String, dynamic> json)
Create a new instance from a json
factory
Attachment.fromOGAttachment(OGAttachmentResponse ogAttachment)
factory

Properties

actions List<Action>?
Actions from a command
final
assetUrl String?
The URL to the audio, video or image related to the URL.
final
authorIcon String?
final
final
authorName String?
The name of the author.
final
color String?
final
duration Duration

Available on Attachment, provided by the VoiceRecordingAttachmentExtension extension

Returns the duration of the voice recording attachment if available else returns Duration.zero.
no setter
extraData Map<String, Object?>
Map of custom channel extraData
final
fallback String?
final
fields → dynamic
final
file AttachmentFile?
The file present inside this attachment.
final
fileSize int?
Shortcut for file size.
no setter
final
footerIcon String?
final
hashCode int
The hash code for this object.
no setterinherited
id String
The attachment ID.
final
imageUrl String?
The URL to the attached image. This is present for URL pointing to an image article (eg. Unsplash)
final
isAudio bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is an audio file.
no setter
isFile bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is a file.
no setter
isGiphy bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is a gif created using Giphy.
no setter
isImage bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is an image.
no setter
isUrlPreview bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is a URL preview.
no setter
isVideo bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is a video.
no setter
isVoiceRecording bool

Available on Attachment, provided by the AttachmentTypeHelper extension

True if the attachment is a voice recording.
no setter
localUri Uri?
final
mimeType String?
Shortcut for file mimeType.
no setter
ogScrapeUrl String?
The original URL that was used to scrape this attachment.
final
originalHeight int?
The original height of the attached image.
final
originalSize Size?

Available on Attachment, provided by the OriginalSizeX extension

Returns the size of the attachment if it is an image or giffy. Otherwise, returns null.
no setter
originalWidth int?
The original width of the attached image.
final
pretext String?
Optional text that appears above the attachment block
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
rawType String?
The raw attachment type.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
text String?
The attachment text. It will be displayed in the channel next to the original message.
final
thumbUrl String?
The URL to the attached file thumbnail. You can use this to represent the attached link.
final
title String?
The attachment title
final
The link to which the attachment message points to.
final
type AttachmentType?
The attachment type based on the URL resource. This can be: audio, image or video
no setter
uploadState UploadState
The current upload state of the attachment
final
waveform List<double>

Available on Attachment, provided by the VoiceRecordingAttachmentExtension extension

Returns the waveform data of the voice recording attachment if available else returns an empty list.
no setter

Methods

copyWith({String? id, String? type, String? titleLink, String? title, String? thumbUrl, String? text, String? pretext, String? ogScrapeUrl, String? imageUrl, String? footerIcon, String? footer, dynamic fields, String? fallback, String? color, String? authorName, String? authorLink, String? authorIcon, String? assetUrl, List<Action>? actions, int? originalWidth, int? originalHeight, AttachmentFile? file, UploadState? uploadState, Map<String, Object?>? extraData}) Attachment
giphyInfo(GiphyInfoType type) GiphyInfo?

Available on Attachment, provided by the GiphyInfoX extension

Returns the GiphyInfo for the given type.
merge(Attachment? other) Attachment
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toData() Map<String, dynamic>
Serialize to db data
toJson() Map<String, dynamic>
Serialize to json
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

dbSpecificTopLevelFields → const List<String>
Known db specific top level fields. Useful for Serializer methods.
topLevelFields → const List<String>
Known top level fields. Useful for Serializer methods.