Attachment class Null safety
The class that contains the information about an attachment
- Inheritance
- Annotations
-
- @JsonSerializable(includeIfNull: false)
Constructors
-
Attachment({String? id, String? type, String? titleLink, String? title, String? thumbUrl, String? text, String? pretext, String? ogScrapeUrl, String? imageUrl, dynamic fields, String? fallback, String? color, String? authorName, String? authorLink, String? authorIcon, String? assetUrl, List<
Action> ? actions, Map<String, Object?> extraData = const {}, AttachmentFile? file, UploadState? uploadState}) - 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
Properties
-
actions
→ List<
Action> -
Actions from a command
@JsonKey(defaultValue: []), final
- assetUrl → String?
-
The URL to the audio, video or image related to the URL.
final
-
final
-
final
-
The name of the author.
final
- color → String?
-
final
-
extraData
→ Map<
String, Object?> -
Map of custom channel extraData
@JsonKey(includeIfNull: false), final
- fallback → String?
-
final
- fields → dynamic
-
final
- file → AttachmentFile?
-
The file present inside this attachment.
final
- fileSize → int?
-
Shortcut for file size.
@JsonKey(ignore: true), read-only
-
final
-
final
- hashCode → int
-
The hash code for this object.
read-only, inherited
- 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
- localUri → Uri?
-
final
- mimeType → String?
-
Shortcut for file mimeType.
@JsonKey(ignore: true), read-only
- ogScrapeUrl → String?
-
The original URL that was used to scrape this attachment.
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.
read-only, override
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.read-only, inherited - 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
- titleLink → String?
-
The link to which the attachment message points to.
final
- type → String?
-
The attachment type based on the URL resource. This can be: audio,
image or video
final
- uploadState ↔ UploadState
-
The current upload state of the attachment
late, final
Methods
-
copyWith(
{String? id, String? type, String? titleLink, String? title, String? thumbUrl, String? text, String? pretext, String? ogScrapeUrl, String? imageUrl, dynamic fields, String? fallback, String? color, String? authorName, String? authorLink, String? authorIcon, String? assetUrl, List< Action> ? actions, AttachmentFile? file, UploadState? uploadState, Map<String, Object?> ? extraData}) → Attachment -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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.['id', 'upload_state', 'file']
-
topLevelFields
→ const List<
String> -
Known top level fields.
Useful for
Serializer
methods.['type', 'title_link', 'title', 'thumb_url', 'text', 'pretext', 'og_scrape_url', 'image_url', 'footer_icon', 'footer', &…