getTotalUnreadMessageCount static method

Future<V2TimValueCallback<int>> getTotalUnreadMessageCount()

Implementation

static Future<V2TimValueCallback<int>> getTotalUnreadMessageCount() async {
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  int res = desktopSDK.D_TIMConvGetTotalUnreadMessageCount(user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<int>.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    return V2TimValueCallback<int>.fromJson({"code": data["code"], "desc": data["desc"], "data": json.decode(data["json_param"].isEmpty ? json.encode({}) : data["json_param"])["conv_get_total_unread_message_count_result_unread_count"]});
  }
}