fetchCombineMessageDetail method

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

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.

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;
  }
}