Class
class with a constructor class Fruit { String type ; // Constructor - Same name as class Fruit( this . type ) ; } void main () { Fruit fruit = Fruit ( 'apple' ) ; print(fruit. type ) ; } named parameters class Fruit { String type ; // Constructor - Same name as class Fruit({ this . type }) ; //new } void main () { Fruit fruit = Fruit (type: 'Apple' ) ; //new print(fruit. type ) ; } class that does not define a constructor class BaristaNoConstructor { String name ; int experience ; } void main () { BaristaNoConstructor baristaNoConstructor = BaristaNoConstructor() ; baristaNoConstructor.experience = 10 ; print( 'baristaNoConstructor.experience: ${baristaNoConstructor.experience} ' ) ; // baristaNoConstructor.experience: 10 } class that defines a constructor with named parameters class BaristaWithConstructor { String name ; int experience ; // Constructor - Named parameters by using { } BaristaWithConstructor({ this . name , this ...