resendMessage method

Future<ChatMessage> resendMessage(
  1. ChatMessage message
)

~english Resends a message.

Param message The message object to be resent: ChatMessage. ~end

~chinese 重发消息。

Param message 需要重发的消息。

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

Implementation

Future<ChatMessage> resendMessage(ChatMessage message) async {
  message.status = MessageStatus.PROGRESS;
  Map result = await ChatChannel.invokeMethod(
      ChatMethodKeys.resendMessage, message.toJson());
  try {
    ChatError.hasErrorFromResult(result);
    ChatMessage msg =
        ChatMessage.fromJson(result[ChatMethodKeys.resendMessage]);
    message.from = msg.from;
    message.to = msg.to;
    message.status = msg.status;
    return message;
  } on ChatError catch (e) {
    throw e;
  }
}