getMessageByServerMessageId method Null safety

Future getMessageByServerMessageId(
  1. {@required dynamic type,
  2. @required String? serverMessageId}
)

获取本地单条消息 @param target 聊天对象, JMSingle | JMGroup @param serverMessageId 服务器返回的 serverMessageId,非本地数据库中的消息id,

Implementation

Future<dynamic> getMessageByServerMessageId({
  @required dynamic type,

  /// (JMSingle | JMGroup | JMChatRoom)
  @required String? serverMessageId,
}) async {
  Map param = type.toJson();

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

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

  return JMNormalMessage.generateMessageFromJson(msgMap);
}