Flutter MediaQuery.of(context).size.width values are different than real screen resolution Flutter MediaQuery.of(context).size.width values are different than real screen resolution flutter flutter

Flutter MediaQuery.of(context).size.width values are different than real screen resolution


According to the size property's documentation :

The size of the media in logical pixels (e.g, the size of the screen).

Logical pixels are roughly the same visual size across devices. Physical pixels are the size of the actual hardware pixels on the device. The number of physical pixels per logical pixel is described by the devicePixelRatio.

So you would do MediaQuery.of(context).size.width * MediaQuery.of(context).devicePixelRatioto get the width in physical pixels.