toJson method

Map<String, dynamic> toJson()

Converts this conversation to a JSON representation.

Returns a Map containing all the conversation data in JSON format.

Implementation

Map<String, dynamic> toJson() => {
      'id': id,
      'title': title,
      'messages': messages.map((msg) => msg.toJson()).toList(),
      'createdAt': createdAt.toIso8601String(),
      'updatedAt': updatedAt?.toIso8601String(),
    };