toJSON method

Map<String, dynamic> toJSON()

Implementation

Map<String, dynamic> toJSON() {
  return <String, dynamic>{
    //'id': id,
    'ownerId': ownerId,
    'profileName': profileName,
    'profileImgUrl': profileImgUrl,
    'text': text,
    'createdTime': createdTime,
    'seenTime': seenTime,
    'type': type.name,
    'mediaUrl': mediaUrl,
    'referenceId': referenceId,
    'audioDuration': audioDuration,
    'likedProfiles': likedProfiles,
    'isPinned': isPinned,
    'pollId': pollId,
    'reactions': reactions,
    'threadParentId': threadParentId,
    'replyCount': replyCount,
    'pollData': pollData,
    'receivedMedia': receivedMedia,
    if (replyData != null) 'replyData': replyData,
    if (locationData != null) 'locationData': locationData,
    if (documentData != null) 'documentData': documentData,
    if (contactData != null) 'contactData': contactData,
    if (localFilePath.isNotEmpty) 'localFilePath': localFilePath,
    if (deliveryStatus.isNotEmpty) 'deliveryStatus': deliveryStatus,
    if (deliveredTime > 0) 'deliveredTime': deliveredTime,
    if (editedTime > 0) 'editedTime': editedTime,
    if (isDeletedForEveryone) 'isDeletedForEveryone': isDeletedForEveryone,
    if (hiddenForProfileIds.isNotEmpty)
      'hiddenForProfileIds': hiddenForProfileIds,
    if (isForwarded) 'isForwarded': isForwarded,
    if (starredByProfileIds.isNotEmpty)
      'starredByProfileIds': starredByProfileIds,
    if (hopCount > 0) 'hopCount': hopCount,
    if (distanceMeters != null) 'distanceMeters': distanceMeters,
  };
}