isVoteMessage static method

bool isVoteMessage(
  1. V2TimMessage message
)

Implementation

static bool isVoteMessage(V2TimMessage message) {
  bool isVoteMessage = false;
  V2TimCustomElem? custom = message.customElem;

  if (custom != null) {
    String? data = custom.data;
    if (data != null && data.isNotEmpty) {
      try {
        Map<String, dynamic> mapData = json.decode(data);
        if (mapData["businessID"] == "group_poll") {
          isVoteMessage = true;
        }
      } catch (err) {
        // err
      }
    }
  }
  return isVoteMessage;
}