How to get the ScreenSize from a Flutter App for Windows Desktop?

Issue

WidgetsBinding.instance.window.physicalSize.width / WidgetsBinding.instance.window.physicalSize.height;
is 1024.0*1898.0,

and DesktopWindow.getWindowSize();
is Size(0.0, 0.0)

on a 4K monitor.

How can I get the real screen size?
(should be 2160*3840)

Solution

Currently getting the screen size requires a plugin, such as window_size.

With window_size, getScreenList() or getCurrentScreen() will give you screen information, including size.

Answered By – smorgan

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *