downloadAttachment method

Future<void> downloadAttachment(
  1. EMMessage message
)

~english Downloads the attachment files from the server.

You can call the method again if the attachment download fails.

Param message The message with the attachment that is to be downloaded.

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

~chinese 下载消息的附件。

若附件自动下载失败,也可以调用此方法下载。

Param message 要下载附件的消息。

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

Implementation

Future<void> downloadAttachment(EMMessage message) async {
  Map result = await ChatChannel.invokeMethod(
      ChatMethodKeys.downloadAttachment, {"message": message.toJson()});
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}