fetchReactionDetail method Null safety

Future<EMCursorResult<EMMessageReaction>> 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 {@link 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.setValueWithOutNull("cursor", cursor);
  req.setValueWithOutNull("pageSize", pageSize);
  Map result = await EMMethodChannel.ChatManager.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;
  }
}