I'm learning Dart using the Dart Apprentice book. Can you tell me why this code shows 0 as id even though I have created const object as const vicki = User(id: 24, name: 'Vicki');
Please let me know what the issue is with this code?
void main() {
const vicki = User(id: 24, name: 'Vicki');
print(vicki.id); // it shows 0. But it must be 24
}
class User {
final int id = 0;
final String name = '';
const User({int id = 0, String name = "anonymous"});
}