Attachment.fromJson constructor

Attachment.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory Attachment.fromJson(Map<String, Object?> json) {
  return Attachment(
    id: json[r'id'] as String?,
    status: json[r'status'] as String?,
    title: json[r'title'] as String?,
    createdAt: DateTime.tryParse(json[r'createdAt'] as String? ?? ''),
    pageId: json[r'pageId'] as String?,
    blogPostId: json[r'blogPostId'] as String?,
    customContentId: json[r'customContentId'] as String?,
    mediaType: json[r'mediaType'] as String?,
    mediaTypeDescription: json[r'mediaTypeDescription'] as String?,
    comment: json[r'comment'] as String?,
    fileId: json[r'fileId'] as String?,
    fileSize: (json[r'fileSize'] as num?)?.toInt(),
    webuiLink: json[r'webuiLink'] as String?,
    downloadLink: json[r'downloadLink'] as String?,
    version: json[r'version'] != null
        ? Version.fromJson(json[r'version']! as Map<String, Object?>)
        : null,
    links: json[r'_links'] != null
        ? AttachmentLinks.fromJson(json[r'_links']! as Map<String, Object?>)
        : null,
  );
}