Repository navigation
flutter: prefer const for Color class - #197
Conversation
e2ae2aa to
9c2ffcf
Compare
|
I could merge this, but if you are thinking in adding to other things, it will be very hard. You will never be satisfied with const in Flutter. What do you think? Because lint will now complain BorderSide is not const. |
|
I thought about adding |
|
Const will not bring any benefit to your code. I can merge this, but really don't worry. If your app has 2000 const or none, it could be 1% faster. I once added hundreds of const and had no difference in benchmarks. |
|
Most likely the compiler will optimise, but due to some lint rules we follow at work this will stop those screams at least. |
|
Yeah, but the issue is that everything else except const will still scream :( so this is just moving the lint error to somewhere else, but will definitely still happen. I think there is a dart fix that auto-fixes that now, so you will still need to run it, or disable the lint (I recommend disabling the lint) |
9c2ffcf to
2b4ed14
Compare
|
In Flutter, the correct syntax is Colors.white without const. The Colors class in Flutter provides predefined color constants, and white is one of those constants. |
2b4ed14 to
1030e1c
Compare
1030e1c to
8e763f1
Compare
No description provided.