DEV Community

Discussion on: Flutter Performance Tips (#1): const constructors

 
tatsuukraine profile image
Denis Beketsky

I think it's just a question of overall optimization. Using const allows you to minimize memory allocation, also it allows you to define such items only once during AOT compilation. It's definetly not improve your app performance significantly, but using const will make it a little bit faster. If you have for instance 100 items probably this const optimization won't make huge performance boost. You can search across internet how dart treats with const variables. For example you can take a look in official docs about StatelessWidget under Performance considerations section

Thread Thread
 
pedromassango profile image
Pedro Massango • Edited

Lets say that it is a small performance improvement, but it can add up in larger apps or apps where the view is rebuilt often for example because of animations.
const reduces the required work for the Garbage Collector.

(Updates)
Read more:
api.flutter.dev/flutter/widgets/St...