getConstructors abstract method

List<Constructor> getConstructors()

Gets all constructors declared in this class.

Returns:

  • List of all constructors (both generative and factory)
  • Empty list if no constructors exist

Example:

final ctors = Class.forType<MyClass>().getConstructors();
ctors.forEach((c) => print(c.name));

Includes:

  • Default unnamed constructor
  • Named constructors
  • Factory constructors

Implementation

List<Constructor> getConstructors();