防采集标记:亢少军老师的课程和资料
//object_named_constructor.dart文件
void main(){
//调用Person的命名构造方法
Person p = Person.run();
}
class Person{
//姓名
String name;
//年龄
int age;
//默认构造方法
Person(this.name,this.age);
//命名构造方法
Person.run(){
print('命名构造方法');
}
}
- Dart交流群:1046954554
- Flutter开源项目请关注: https://github.com/kangshaojun
@作者: 亢少军