There is a post on dart's website and it explains it pretty well.

Final:

"final" means single-assignment: a final variable or field must have an initializer. Once assigned a value, a final variable's value cannot be changed. final modifies variables.


Const:

"const" has a meaning that's a bit more complex and subtle in Dart. const modifies values. You can use it when creating collections, like const [1, 2, 3], and when constructing objects (instead of new) like const Point(2, 3). Here, const means that the object's entire deep state can be determined entirely at compile time and that the object will be frozen and completely immutable.

Const objects have a couple of interesting properties and restrictions:

They must be created from data that can be calculated at compile time. A const object does not have access to anything you would need to calculate at runtime. 1 + 2 is a valid const expression, but new DateTime.now() is not.

They are deeply, transitively immutable. If you have a final field containing a collection, that collection can still be mutable. If you have a const collection, everything in it must also be const, recursively.

They are canonicalized. This is sort of like string interning: for any given const value, a single const object will be created and re-used no matter how many times the const expression(s) are evaluated.


So, what does this mean?

Const:
If the value you have is computed at runtime (new DateTime.now(), for example), you can not use a const for it. However, if the value is known at compile time (const a = 1;), then you should use const over final. There are 2 other large differences between const and final. Firstly, if you're using const inside a class, you have to declare it as static const rather than just const. Secondly, if you have a const collection, everything inside of that is in const. If you have a final collection, everything inside of that is not final.

Final:
final should be used over const if you don't know the value at compile time, and it will be calculated/grabbed at runtime. If you want an HTTP response that can't be changed, if you want to get something from a database, or if you want to read from a local file, use final. Anything that isn't known at compile time should be final over const.


With all of that being said, both const and final cannot be reassigned, but fields in a final object, as long as they aren't const or final themselves, can be reassigned (unlike const).

Answer from meyi on Stack Overflow
Top answer
1 of 16
740

There is a post on dart's website and it explains it pretty well.

Final:

"final" means single-assignment: a final variable or field must have an initializer. Once assigned a value, a final variable's value cannot be changed. final modifies variables.


Const:

"const" has a meaning that's a bit more complex and subtle in Dart. const modifies values. You can use it when creating collections, like const [1, 2, 3], and when constructing objects (instead of new) like const Point(2, 3). Here, const means that the object's entire deep state can be determined entirely at compile time and that the object will be frozen and completely immutable.

Const objects have a couple of interesting properties and restrictions:

They must be created from data that can be calculated at compile time. A const object does not have access to anything you would need to calculate at runtime. 1 + 2 is a valid const expression, but new DateTime.now() is not.

They are deeply, transitively immutable. If you have a final field containing a collection, that collection can still be mutable. If you have a const collection, everything in it must also be const, recursively.

They are canonicalized. This is sort of like string interning: for any given const value, a single const object will be created and re-used no matter how many times the const expression(s) are evaluated.


So, what does this mean?

Const:
If the value you have is computed at runtime (new DateTime.now(), for example), you can not use a const for it. However, if the value is known at compile time (const a = 1;), then you should use const over final. There are 2 other large differences between const and final. Firstly, if you're using const inside a class, you have to declare it as static const rather than just const. Secondly, if you have a const collection, everything inside of that is in const. If you have a final collection, everything inside of that is not final.

Final:
final should be used over const if you don't know the value at compile time, and it will be calculated/grabbed at runtime. If you want an HTTP response that can't be changed, if you want to get something from a database, or if you want to read from a local file, use final. Anything that isn't known at compile time should be final over const.


With all of that being said, both const and final cannot be reassigned, but fields in a final object, as long as they aren't const or final themselves, can be reassigned (unlike const).

2 of 16
319

Const

Value must be known at compile-time, const birthday = "2008/12/25"
Can't be changed after initialized.


Final

Value must be known at run-time, final birthday = getBirthDateFromDB()
Can't be changed after initialized.

🌐
Dart
dart.dev › language › variables
Variables
If you never intend to change a variable, use final or const, either instead of var or in addition to a type. A final variable can be set only once; a const variable is a compile-time constant.
🌐
GeeksforGeeks
geeksforgeeks.org › dart › dart-const-and-final-keyword
Dart - Const And Final Keyword - GeeksforGeeks
April 2, 2025 - Can't assign to the final variable 'geek1'. ... The Const keyword in Dart behaves similarly to the final keyword. The only difference between final and const is that the const makes the variable constant from compile-time only.
🌐
LinkedIn
linkedin.com › pulse › title-understanding-final-const-dart-when-use-each-neha-tanwar
Title: Understanding Final and Const in Dart: When to Use Each
September 30, 2023 - In Dart, a final variable represents a single-assignment variable. Once assigned a value, you cannot change it. Here's how you declare a final variable: ... On the other hand, const variables are compile-time constants.
🌐
Medium
medium.com › @kavyamistry0612 › understanding-const-and-final-in-dart-f8b889cb7d63
Understanding const and final in Dart | by Kavy mistry | Medium
January 20, 2024 - The usage of const ensures that the values are known at compile time, making it efficient for certain scenarios. The final keyword, on the other hand, is used to declare variables whose values cannot be changed after they are initialized.
🌐
Reddit
reddit.com › r/flutterdev › why dart has both final and const?
r/FlutterDev on Reddit: why dart has both final and const?
September 12, 2023 -

before you down vote hear me out first...

I know const is used for compile time values and final for immutable run time values.

but the thing is the linter seems to understand where const can be used. if thats the case then why? why would you annoy me every time to add const. also it makes the syntax more annoying.

wouldn't it be a better idea to move it to the compiler level? or am I missing something?

🌐
DhiWise
dhiwise.com › post › leveraging-constants-dart-const-vs-final-best-practices
Mastering Dart Programming: 'const' vs. 'final' Explained
December 19, 2024 - The const keyword ensures that ... after compilation. When working with Dart, the final keyword is your ally in creating variables that need to be assigned once and only once....
🌐
Dart Tutorial
dart-tutorial.com › final vs const › useful information › dart tutorial - learn dart programming
Final Vs Const :: Dart Tutorial - Learn Dart Programming
If you need to calculate value at compile-time, it is a good idea to choose const over final. A const variable is a compile-time constant. They must be created from data that can be calculated at compile time.
Find elsewhere
🌐
Educative
educative.io › answers › whats-the-difference-between-static-const-and-final-in-dart
What’s the difference between static, const, and final in Dart?
The final and const both ensure variable immutability, while const specifically creates compile-time constants. The static variable operates at the class level, shared across instances.
🌐
Dartlang
news.dartlang.org › 2012 › 06 › const-static-final-oh-my.html
Const, Static, Final, Oh my!
That's all it means, and it isn't used for anything else. static modifies *members*. "final" means single-assignment: a final variable or field *must* have an initializer. Once assigned a value, a final variable's value cannot be changed. final modifies *variables*. "const" has a meaning that's ...
🌐
Medium
medium.com › @naveenjose24 › dart-const-vs-final-understanding-the-differences-and-when-to-use-each-65263ebf5d89
“Dart Const vs. Final: Understanding the Differences and When to Use Each” | by Naveen Jose | Medium
October 20, 2023 - Understanding the advantages and limitations of `const` is crucial for writing efficient and reliable Dart code. In Dart, the `final` keyword is used to declare variables that can be assigned a value only once.
🌐
HowDev
how.dev › answers › what-is-the-difference-between-const-and-final-keyword-in-dart
What is the difference between const and final keyword in dart?
The const and final keywords declare constants values in Dart that can't be changed after initializing them. However, the main difference lies in their time of evaluation.
🌐
YouTube
youtube.com › watch
Dart Tutorial #4 - Difference between final and const keywords in Dart Programming - YouTube
Dart Tutorial #4 - Difference between final and const keywords in Dart ProgrammingIn this video by Programming for Beginners we will see difference between f...
Published   March 31, 2022
🌐
Code With Andrea
codewithandrea.com › tips › const-vs-final-vs-var
Prefer const over final over var
void main() { // compile-time constant const favourite = 'I like pizza with tomatoes'; // read-only variable, set just once final newFavourite = favourite.replaceAll('pizza', 'pasta'); // read/write variable, set more than once var totalSpaces = 0; for (var i = 0; i < newFavourite.length; i++) { final c = newFavourite[i]; if (c == ' ') { totalSpaces++; } print('Counted $totalSpaces spaces'); } }
🌐
ITNEXT
itnext.io › difference-between-const-and-final-in-dart-78c129d0c573
Difference between Const and Final in Dart | ITNEXT
October 26, 2020 - You can’t define const inside a class. But you can in a function. For Flutter specific, everything in the build method won’t be initialized again when the state is updated. ... Use final: If you don’t know what it’s value will be at compile-time.
🌐
Flutter Clutter
flutterclutter.dev › flutter › basics › 2022-12-06-static-final-const-dynamic-var
Static, final, const, dynamic, var - differences and similarities 🤓
This way you can avoid using var and dynamic and all the issues associated with these keywords completely. final should be used by default for every newly defined variable as it protects the developer from unwanted reassignments of variables. const ...
🌐
Quora
quora.com › Whats-the-difference-between-a-final-and-a-const-variable-in-Dart
Whats the difference between a final and a const variable in Dart? - Quora
Answer: `final` prevents to assign a different value to a “variable” after it was first initialized. [code]void main() { final x = 10; x = 20; // error assigning to a final variable final y; // error uninitialized final variable } [/code]For class’ fields there are some rules that limit wh...
🌐
Flutter Agency
blog.flutteragency.com › home › what is the difference between the const and final keywords in dart?
The Main Difference Between Const and Final Keyword in Dart | Flutter Agency
January 28, 2021 - The final modifier should be the more commonly used, because many program variables won’t need any memory since the program logic won’t call for them to be initialized. With a const variable, you are basically telling the computer, “Hey, ...
🌐
mixable Blog
mixable.blog › home › dart: what is the difference between the “const” and “final” keywords?
Dart: what is the difference between "const" and "final"? | mixable Blog
May 2, 2024 - In general, use const when you have a value that will never change and you want to ensure that only one instance of it exists, and use final when you have a value that won’t change but can’t be known at compile time.