Recently dart realeased the new feature called null safety. I have a little bit confusion in how to create constructors with named parameters. When I follow the use of curly braces, I get an error.
Here is my code:
void main() {
}
class Student {
String name = '';
num age = 0;
List<num> marks = [];
Student({
this.name,
this.age,
this.marks
});
void printStudentDetails() {
print('Student Name: ' + this.name);
}
}
