Flutter 3.10 has come with several improvements for MediaQuery
use. And I see that we can for example get the Size using MediaQuery.of(context).size
as usual, but now we can use MediaQuery.sizeOf(context)
.
Which is more performant? The latter? Which is the recommendation?
EDIT (2023-06-15): I'm refining the question. The core of the question is not about getting a Size
, this is just a simple example of the new ways of using MediaQuery
new ways of getting the same data using new available methods. That could be with MediaQuery.of(context).platformBrightness
- MediaQuery.platformBrightnessOf(context)
or another one.
After reading some resources, what @peter-koltai shared as a comment is pretty accurate.
Then the answer could be summarized as follow (Summary taken from Andrea Bizzoto):
Take a look of this issue where the concept is well explained.