It is option to declare within the class. All class have own constructor but if we don’t declare or forget then Dart compiler will create default constructor automatically by passing the default value to the member variable.
Read moreWhat are Dart constructors?
Dart Constructors A constructor is a special function of the class that is responsible for initializing the variables of the class . Dart defines a constructor with the same name as that of the class.
Read moreHow many types of constructors are there in Flutter?
We can define constructor with two types of parameters: required and optional .16 Mar 2022
Read more