downloadAttachment method

Future<void> downloadAttachment(
  1. ChatMessage message
)

下载消息的附件。

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

Param message 要下载附件的消息。

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

Implementation

Future<void> downloadAttachment(ChatMessage message) async {
  try {
    Map result = await platform_interface.Client.instance.chatManager.callNativeMethod(
        ChatMethodKeys.downloadAttachment, {"message": message.toJson()});
    ChatError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}