fetchReactionDetail method

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

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 ChatError.

Implementation

Future<ChatCursorResult<ChatMessageReaction>> 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 {
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult<ChatMessageReaction>.fromJson(
        result[ChatMethodKeys.fetchReactionDetail],
        dataItemCallback: (value) {
      return ChatMessageReaction.fromJson(value);
    });
  } on ChatError catch (e) {
    throw e;
  }
}