The keyword ________ is used to define a named constructor in Dart.

  • 'constructor'
  • 'factory'
  • 'new'
  • 'this'
The keyword 'factory' is used to define a named constructor in Dart. Named constructors provide a way to create instances of a class with different configurations or initializations. The 'factory' keyword is used in conjunction with the constructor name to declare a named constructor. Understanding how to use named constructors with 'factory' is essential for building flexible and modular Dart classes that support various instantiation scenarios.
Add your answer
Loading...

Leave a comment

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