setChatHistory method
Implementation
Future<void> setChatHistory(Message message) async {
try {
var key = AtKey()
..key = storageKey +
(isGroupChat ? groupChatId! : '') +
(chatWithAtSign ?? ' ').substring(1)
..metadata = Metadata();
chatHistory.insert(0, message);
chatSink.add(chatHistory);
chatHistoryMessages!.add(message.toJson());
await atClientInstance.put(key, json.encode(chatHistoryMessages));
} catch (e) {
print('Error in setting chat => $e');
}
}