getAllConversations method

Future<Map<String, EMConversation>> getAllConversations ()

获取所有会话

Implementation

Future<Map<String, EMConversation>> getAllConversations() async {
  Map<String, dynamic> result = await _emChatManagerChannel
      .invokeMethod(EMSDKMethod.getAllConversations);
  if (result['success']) {
    var data = HashMap<String, EMConversation>();
    var conversations = result['conversations'] as List<dynamic>;
    for (var conversation in conversations) {
      data[conversation['id']] = EMConversation.from(conversation);
    }
    return data;
  } else {
    return null;
  }
}