We can dynamically know and perform certain actions Based on certain assumptions like if the width & height of the device are certainly this. In such cases, we can use window size classes.
Height-Based Window Size Classes
Width-Based Window Size Classes
With the assumptions we can know if the device is one of the categories