Its depends.
const: If the value is known at compile time you should use const.
Use const for variables that you want to be compile-time constants. If
the const variable is at the class level, mark it static const. Where
you declare the variable, set the value to a compile-time constant
such as a number or string literal, a const variable, or the result of
an arithmetic operation on constant numbers:
const bar = 1000000; // Unit of pressure (dynes/cm2)
const double atm = 1.01325 * bar; // Standard atmosphere
final: If you do not know the value at compile time, but it would be generated at runtime.
Final instance variables must be initialized before the constructor
body starts.
class Data {
final String token;
final DoctorProfile doctor;
final UserProfile userProfile;
Data({this.token, this.doctor, this.userprofile});
}
Reference:
- Final and const
2.What is the difference between the “const” and
“final” keywords in Dart?