What difference between
When using
When using
#performanceimprovment #difference
final and const?When using
final the value can be assigned at runtime, but only onceWhen using
const you must assign value before compilation. So, it must be available at the time of compilationconst 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