Reputation: 420
I'm learning Flutter right now with an Udemy course. The instructor always writes the code like this:
padding: EdgeInsets.all(8.0),
However in Android Studio, when you add "wrap with padding" it adds const
(isn't this a unchangeable variable?). Also in Flutter documentation it has always used const
.
padding: const EdgeInsets.all(8.0),
Upvotes: 1
Views: 540
Reputation: 3072
If you know the values will not change along the screen lifecicle is better use const variables, they are better for the performance. But you can do without const, the difference is not so big. See this thread: What is the difference between the "const" and "final" keywords in Dart?
Upvotes: 3