You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In theory, const-ness should give apps a performance boost, but during development the lints enforcing const are constantly nagging developers: "Make this const" or "This cannot be const anymore". To evaluate whether we are making the right trade-offs here between annoyingness and performance we ran some benchmarks (see flutter/flutter#149932). The benchmarks have not shown sufficient evidence to suggest that there is a statistically significant difference in performance between const and nonconst for real world apps1. Given these results, the lints that constantly nag developers during development are not carrying their weight and I suggest we remove them from the flutter_lints set. People can still manually enable them for their app, if they like.
Lints suggested for removal from the flutter_lints set (they can still be enabled manually):
prefer_const_constructors
prefer_const_literals_to_create_immutables
prefer_const_declarations
I suggest we keep the forth const lint (prefer_const_constructors_in_immutables) because it is very narrow in scope and generally doesn't cause any pain during development. It also enables downstream consumers to make their own choice of whether they want to create a const instance of a widget or not.
Footnotes
In a contrived benchmark that did not represent real world usage in Flutter apps we were able to show that const in general can give you a small performance advantage. ↩
The text was updated successfully, but these errors were encountered:
This has been dropped from the upstream "recommended" set [1]. Some
benchmarks haven't revealed sizable performance gains [2].
Let's just ignore it instead of fixing 294 warnings.
[1]: dart-lang/core#843
[2]: dart-lang/core#833
This issue was closed.
This issue is being transferred. Timeline may not be complete until it finishes.
In theory, const-ness should give apps a performance boost, but during development the lints enforcing const are constantly nagging developers: "Make this const" or "This cannot be const anymore". To evaluate whether we are making the right trade-offs here between annoyingness and performance we ran some benchmarks (see flutter/flutter#149932). The benchmarks have not shown sufficient evidence to suggest that there is a statistically significant difference in performance between const and nonconst for real world apps1. Given these results, the lints that constantly nag developers during development are not carrying their weight and I suggest we remove them from the
flutter_lints
set. People can still manually enable them for their app, if they like.Lints suggested for removal from the flutter_lints set (they can still be enabled manually):
prefer_const_constructors
prefer_const_literals_to_create_immutables
prefer_const_declarations
I suggest we keep the forth const lint (
prefer_const_constructors_in_immutables
) because it is very narrow in scope and generally doesn't cause any pain during development. It also enables downstream consumers to make their own choice of whether they want to create a const instance of a widget or not.Footnotes
In a contrived benchmark that did not represent real world usage in Flutter apps we were able to show that const in general can give you a small performance advantage. ↩
The text was updated successfully, but these errors were encountered: