Closed
Description
I mainly use Dart for Flutter and declaring Widgets as const
brings performance improvements. On the other hand it's boring to type const
all the time, or verifying which constructors are const
, or even having to fix a constructor call that just got broken because it was declared as const
and now can't be evaluated at compile time.
A linter warning helps to remember to use const
, but actually using them isn't much comfortable.
It would be amazing if the compiler could automatically understand what can be promoted to const
and optimize the code as const
behind the scenes.