CommsAttachment.fromJson constructor

CommsAttachment.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CommsAttachment.fromJson(Map<String, dynamic> json) {
  return CommsAttachment(
    width: json['width'] as int?,
    height: json['height'] as int?,
    fileKey: json['file_key'] as String?,
    fileUrl: (json['file_url'] ?? json['url'] ?? '').toString(),
    thumbnailUrl:
        (json['thumbnail_url'] ?? json['thumbnail'] ?? json['poster'])
            ?.toString(),
    blurHash: json['blur_hash'] as String?,
    fileName: json['file_name'] as String?,
    fileSize: json['file_size'] as int?,
    fileType: (json['file_type'] ?? json['type'] ?? 'image').toString(),
    contentType: json['content_type'] as String?,
  );
}