What is difference between const and final in Dart?

The final keyword in Dart is used to create constants or objects that are immutable in nature. The only difference between the final and const keyword is that final is a runtime-constant , which in turn means that its value can be assigned at runtime instead of the compile-time that we had for the const keyword.

Sizin İçin Seçtik  How do you declare a static variable in a class?

Leave a Reply

Your email address will not be published. Required fields are marked *

What is difference between const and final in Dart?

The final keyword in Dart is used to create constants or objects that are immutable in nature. The only difference between the final and const keyword is that final is a runtime-constant , which in turn means that its value can be assigned at runtime instead of the compile-time that we had for the const keyword.

Sizin İçin Seçtik  How do you declare an optional parameter?

Leave a Reply

Your email address will not be published. Required fields are marked *