getMessageById method

Future getMessageById (
  1. {@required dynamic type,
  2. @required String messageId}
)

获取本地单条消息

  • @param target 聊天对象, JMSingle | JMGroup
  • @param messageId 本地数据库中的消息id,非 serverMessageId

Implementation

Future<dynamic> getMessageById({
  @required dynamic type, /// (JMSingle | JMGroup | JMChatRoom)
  @required String messageId,
}) async {
  Map param = type.toJson();

  param..addAll({
      'messageId': messageId,
    });

  Map msgMap = await _channel.invokeMethod('getMessageById',
    param..removeWhere((key,value) => value == null));

  return JMNormalMessage.generateMessageFromJson(msgMap);
}