fetchReactionDetail method

Future<EMCursorResult<EMMessageReaction>> fetchReactionDetail({
  1. required String messageId,
  2. required String reaction,
  3. String? cursor,
  4. int pageSize = 20,
})

~english Gets the Reaction details.

Param messageId The message ID.

Param reaction The Reaction content.

Param cursor The cursor position from which to get Reactions.

Param pageSize The number of Reactions you expect to get on each page.

Return The result callback, which contains the reaction list obtained from the server and the cursor for the next query. Returns null if all the data is fetched.

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

~chinese 获取 Reaction 详情。

Param messageId 消息 ID。

Param reaction Reaction 内容。

Param cursor 开始获取 Reaction 的游标位置, 首次可以不传。

Param pageSize 每页期望返回的 Reaction 数量。

Return 若调用成功,返回 Reaction 详情。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end

Implementation

Future<EMCursorResult<EMMessageReaction>> fetchReactionDetail({
  required String messageId,
  required String reaction,
  String? cursor,
  int pageSize = 20,
}) async {
  Map req = {
    "msgId": messageId,
    "reaction": reaction,
  };
  req.putIfNotNull("cursor", cursor);
  req.putIfNotNull("pageSize", pageSize);
  Map result =
      await ChatChannel.invokeMethod(ChatMethodKeys.fetchReactionDetail, req);

  try {
    EMError.hasErrorFromResult(result);
    return EMCursorResult<EMMessageReaction>.fromJson(
        result[ChatMethodKeys.fetchReactionDetail],
        dataItemCallback: (value) {
      return EMMessageReaction.fromJson(value);
    });
  } on EMError catch (e) {
    throw e;
  }
}