is there anyone facing the same issue in flutter 3.10.1, Dart 3.0.1?
The
MediaQuery.of(context).size.width
and
MediaQuery.of(context).size.height
are always 0.
MediaQuery.of(context).size.width
and
MediaQuery.of(context).size.height
had worked with no issue in previous Flutter 2.19, but i get this issue after upgrade.
2
Answers
I am calling it like
And this is working flawless for me! I have always the newest stable update.
I also tried to call it in a really small Container, also then I still get the full size of the screen.
(Less Likely):
I use Getx and Sizer wrappig over MaterialApp (). Yes that happens with me too. Not only that, your runApp() and sometimes even void main() also gets run multiple times. I think that problem is from flutter side. But if in your case only runApp() gets run multiple times then, currently I solved it by …
you need to use builder or StatelessWidget for context. If you find any better solution from project setting, please share them.