How to get size of screen in Flutter app?

Posted by Andre Scott | Updated on

Want to get size of screen in Flutter app? You can use the MediaQuery class, along with the associated MediaQueryData to determine your screen size and fetch the correct image. You can then compare the MediaQueryData.size member with some predefined screen sizes – this will give you the number of logical pixels.

For example, in the build method of a widget:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers