Object/Instance

Creating an object/instance in dart

void main() {
  
  // Object or Instance 
  
  var employee1 = new Employee();
  
    print(employee1);

}



class Employee{
  
  
  int id;
  
  String name;
  
  String position;
  
  String companyname;
  
  
}


The "new" keyword is optional

Null Safety in Dart 2.9

Last updated

Was this helpful?