toMap method
convert the ChatMessage object to json
Implementation
Map<String, dynamic> toMap() {
return {
'text': text,
'imageUrl': imageUrl,
'imagePath': imagePath,
'audioUrl': audioUrl,
'audioPath': audioPath,
'isSender': isSender,
'createdAt': createdAt?.toIso8601String(),
};
}