What is the difference between final and const in Dart?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Flutter topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
Both final and const declare variables that cannot be reassigned, but they differ in when the value is determined. A final variable is assigned once at runtime — its value can be computed when the program runs (e.g., from a function call or user input). A const variable must have a value known at compile time and creates a deeply immutable, canonicalized object. Using const for widgets and values that never change improves Flutter rendering performance.
Common Mistake
Candidates often give textbook answers here. Interviewers are more impressed when you relate the concept to a specific problem you solved in a real Flutter project.