named constructirs in dart code example
Example: named constructor dart
class Person {
String name;
int age;
Person({this.name = '', this.age = 0});
}
void main() {
Person person1 = Person(name: "Raaj", age: 35);
print(person1.age);
}
class Person {
String name;
int age;
Person({this.name = '', this.age = 0});
}
void main() {
Person person1 = Person(name: "Raaj", age: 35);
print(person1.age);
}