fetchReactionDetail method

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

获取 Reaction 详情。

Param messageId 消息 ID。

Param reaction Reaction 内容。

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

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

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

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

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;
  }
}