Intermediate Flutter
Q57 / 100

What is the difference between final and const in Dart?

Correct! Well done.

Incorrect.

The correct answer is B) final is set once at runtime; const is a compile-time constant — both are immutable after assignment

B

Correct Answer

final is set once at runtime; const is a compile-time constant — both are immutable after assignment

Explanation

final variables are assigned once (runtime) and cannot change. const variables are compile-time constants — values must be known at compile time. const also makes objects deeply immutable and enables object canonicalization.

Progress
57/100