fetchCombineMessageDetail method

Future<List<ChatMessage>> fetchCombineMessageDetail({
  1. required ChatMessage message,
})

~english Gets the details of a combined message.

Param message The combined message.

Return The list of original messages included in the combined message.

Throws A description of the exception. See ChatError. ~end

~chinese 获取合并消息的详情。

Param message 合并消息。

Return 合并消息包含的原始消息列表。

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

Implementation

Future<List<ChatMessage>> fetchCombineMessageDetail({
  required ChatMessage message,
}) async {
  Map map = {
    'message': message.toJson(),
  };

  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.downloadAndParseCombineMessage,
    map,
  );

  try {
    ChatError.hasErrorFromResult(result);
    List<ChatMessage> messages = [];
    List list = result[ChatMethodKeys.downloadAndParseCombineMessage];
    list.forEach((element) {
      messages.add(ChatMessage.fromJson(element));
    });
    return messages;
  } on ChatError catch (e) {
    throw e;
  }
}