getDefaultConstructor abstract method
Gets the default unnamed constructor for this class.
Returns:
- The default constructor if one exists
null
if the class has no default constructor
Example:
class User {
User(this.name); // Default constructor
final String name;
}
final constructor = Class.forType<User>().getDefaultConstructor();
print(constructor?.parameters.length); // 1
Implementation
Constructor? getDefaultConstructor();