deleteRemoteConversation method

Future<void> deleteRemoteConversation(
  1. String conversationId,
  2. {EMConversationType conversationType = EMConversationType.Chat,
  3. bool isDeleteMessage = true}
)

删除服务端的指定 ID 的会话和聊天记录。

Param conversationId 会话 ID。

Param conversationType 会话类型,详见 EMConversationType

Param isDeleteMessage 删除会话时是否同时删除历史消息记录。

  • (默认)true:是;
  • false:否。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError

Implementation

Future<void> deleteRemoteConversation(
  String conversationId, {
  EMConversationType conversationType = EMConversationType.Chat,
  bool isDeleteMessage = true,
}) async {
  Map req = {};
  req["conversationId"] = conversationId;
  if (conversationType == EMConversationType.Chat) {
    req["conversationType"] = 0;
  } else if (conversationType == EMConversationType.GroupChat) {
    req["conversationType"] = 1;
  } else {
    req["conversationType"] = 2;
  }
  req["isDeleteRemoteMessage"] = isDeleteMessage;

  Map data = await ChatChannel.invokeMethod(
      ChatMethodKeys.deleteRemoteConversation, req);
  try {
    EMError.hasErrorFromResult(data);
  } on EMError catch (e) {
    throw e;
  }
}