toJson method

Map<String, dynamic> toJson()

Converts this attachment to a JSON map for database storage.

Implementation

Map<String, dynamic> toJson() {
  return <String, dynamic>{
    'id': id,
    'url': url,
    'name': name,
    'ext': extension,
    'size': size,
    if (mimeType != null) 'mimeType': mimeType,
    if (pageCount != null) 'pageCount': pageCount,
    if (thumbnailUrl != null) 'thumbnailUrl': thumbnailUrl,
    if (localPath != null) 'localPath': localPath,
    if (width != null) 'width': width,
    if (height != null) 'height': height,
    if (thumbhash != null) 'thumbhash': thumbhash,
    if (blurhash != null) 'blurhash': blurhash,
    if (duration != null) 'durationMs': duration!.inMilliseconds,
    if (waveform != null) 'waveform': waveform,
  };
}