magento2.3 – How to get product Quantity in Magento 2

I need to retrieve product quantity, I found the interfaces we used before to get product quantity are deprecated, these are:

MagentoCatalogInventoryApiStockStateInterface $stockItem


MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry

Below link says StockStateInterface is replaced with Multi Source Inventory but I cannot see a function returning product quantity in it.

Is there some other way to get product quantity? I don’t want to use deprecated code.