# Object/Instance

{% embed url="<https://youtu.be/V1nIoUwWobg>" %}

{% embed url="<https://youtu.be/l7TI-yR-SFc>" %}

{% hint style="success" %}
Object/Instance is created from a Class  which you can think as  a blueprint or template for creating that  object/instance.
{% endhint %}

Creating an object/instance in dart&#x20;

{% tabs %}
{% tab title="syntax -1 " %}

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

}



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



```

{% endtab %}

{% tab title="syntax -2 " %}

```dart
void main() {
  
  // Object or Instance 
  
  var employee1 = Employee(); // The new keyword is optional 
  print(employee1);

}


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

{% endtab %}

{% tab title=" syntax -3 " %}

```dart

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

}


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

{% endtab %}
{% endtabs %}

{% hint style="success" %}
Creating an object is sometimes called "**instantiation"**&#x20;
{% endhint %}

{% hint style="info" %}
The "new" keyword is optional&#x20;
{% endhint %}

![](https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDGMJRgnNziYTmRVAyF%2F-MDGMbkqbob0t4mWnj4C%2Fdiagram-20200727.svg?alt=media\&token=3e27e266-288f-43d8-9b38-1b8295991c31)

### <img src="https://1972396024-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MCuqiBdVbVkT07RwbQD%2F-MDR9Mmcax_zEDDFWpHw%2F-MDR9U2BtD1pOB-MZbdE%2Funnamed.png?alt=media&#x26;token=bcedd461-d11d-4256-81c5-fa8afd13df2a" alt="" data-size="line"> Null Safety in Dart 2.9&#x20;
