different constructor syntax in dart code example
Example 1: fluter class constructor
class Customer {
String name;
int age;
String location;
Customer(String name, int age, String location) {
this.name = name;
this.age = age;
this.location = location;
}
}
Example 2: Flutter Constructor
Customer(String name, int age, String location) {
this.name = name;
this.age = age;
this.location = location;
}
Customer(this.name, this.age) {
this.name = name;
this.age = age;
}
Example 3: constructor flutter
class Student{
Student(int enNum){
print(enNum);
}
}
main(){
var myStudent = new Student(15);
}