queryMessageReactionUserList method

Future<Map> queryMessageReactionUserList(
  1. dynamic message,
  2. dynamic config
)

Implementation

Future<Map<dynamic, dynamic>> queryMessageReactionUserList(
    dynamic message, dynamic config) async {
  Object _message = mapToJSObj(message);
  Object _config = mapToJSObj(config);

  final result = await promiseToFuture(
          ZIM.getInstance()!.queryMessageReactionUserList(_message, _config))
      .catchError((e) {
    throw PlatformException(code: e.code.toString(), message: e.message);
  });

  final resultMap = jsObjectToMap(result);

  resultMap['message']['reactions'] =
      resultMap['message']['reactions'] == null
          ? []
          : resultMap['reactions'].forEach((reactionMap) {
              reactionMap['messageID'] = reactionMap['messageID'] is int
                  ? reactionMap['messageID']
                  : int.parse(reactionMap['messageID']);
            });

  resultMap['message']['isBroadcastMessage'] =
      resultMap['message']['isBroadcastMessage'] is bool
          ? resultMap['message']['isBroadcastMessage']
          : false;

  return resultMap;
}