loadAllConversations method Null safety
Gets all conversations from the local database.
Conversations will be first loaded from the cache. If no conversation is found, the SDK loads from the local database.
Return All the conversations from the cache or local database.
Throws A description of the exception. See {@link EMError}.
Implementation
Future<List<EMConversation>> loadAllConversations() async {
Map result = await EMMethodChannel.ChatManager.invokeMethod(
ChatMethodKeys.loadAllConversations);
try {
EMError.hasErrorFromResult(result);
List<EMConversation> conversationList = [];
result[ChatMethodKeys.loadAllConversations]?.forEach((element) {
conversationList.add(EMConversation.fromJson(element));
});
return conversationList;
} on EMError catch (e) {
throw e;
}
}