static

final

const

static

static

final

final

const

const

const [1, 2, 3]

const Point(2, 3)

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. In other words:

getConst() => const [1, 2];

main() {

var a = getConst();

var b = getConst();

print(a === b); // true

}

(This is an "oldie but a goodie" misc@dartlang.org post originally written by Bob Nystrom. It is being posted here as the explanations still ring true.)Bob writes:", "", and "" mean entirely distinct things in Dart:means a member is available on the class itself instead of on instances of the class. That's all it means, and it isn't used for anything else.modifies *members*.means single-assignment: a final variable or field *must* have an initializer. Once assigned a value, a final variable's value cannot be changed.modifies *variables*.has a meaning that's a bit more complex and subtle in Dart.modifies *values*. You can use it when creating collections, like, and when constructing objects (instead of new) like. 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:I think Dart does a pretty good job of keeping the semantics and the keywords nicely clear and distinct. (There was a time where const was used both for const and final. It was confusing.) The only downside is that when you want to indicate a member that is single-assignment and on the class itself, you have to use both keywords: static final.