Dart Class & Constructor

Since Dart is an object oriented language it has classes. The following is an example of a class called Student. Constructors are called upon instantiation of the class. It is valid in Dart that constructors have no body. For Example :

class Student {
  int id;
  String name;
  int age;
  Student(this.id, this.name, this.age); 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *