Flutter Notes
6 subscribers
3 photos
Сhannel about some features in Flutter and Dart
Download Telegram
Channel created
What difference between final and const?

When using final the value can be assigned at runtime, but only once

When using const you must assign value before compilation. So, it must be available at the time of compilation

const is a powerful performance improvement tool (unlike final) when creating so-called canonical instances. You can create your own class using the const constructor and the memory will not be cluttered with dozens of different instances. Instead, whenever you define the same arguments for a const constructor or factory, the same canonical instance will be used.

#performanceimprovment #difference
💩1
💩1