I came across this article in which the author says that it's more performant defining a file with all SizedBox width and height constants that is going to be imported each time a SizedBox is needed.
Is it true? Or how can we confirm what he says is true? Or, what happens if I use his approach, would it be counterproductive?
From the article:
so the thing is not that wer'e creating a separate file, but rather the point is that we're creating
constantsThe reason why
SizedBoxis better, since it can beconstwhich is immutable and created in compile time so it's faster.For example, this code works:
But this code will fail:
Also, take a look at the docs:
See also