toJson method

Map<String, dynamic> toJson()

Convert to JSON.

Implementation

Map<String, dynamic> toJson() => {
      'id': id,
      'conversation': conversation.toJson(),
      'type': type,
      if (text != null) 'text': text,
      if (userId != null) 'userId': userId,
      if (userName != null) 'userName': userName,
      'timestamp': timestamp.toIso8601String(),
      if (attachments != null)
        'attachments': attachments!.map((a) => a.toJson()).toList(),
      if (metadata != null) 'metadata': metadata,
    };