# Constructor class abstract

Provides reflective access to class constructor metadata and instantiation.

This interface enables runtime inspection and invocation of class constructors, including access to:

- Constructor parameters
- Factory constructor detection
- Instance creation
- Declaring class information

{@template constructor_interface_features}

## Key Features

- Named and unnamed constructor support
- Parameter inspection
- Type-safe instance creation
- Factory constructor handling

## Implementation Notes

Concrete implementations typically wrap platform-specific reflection objects while providing this uniform interface.

## Example Usage

    // Get constructor metadata
    final namedConstructor = userClass.getConstructor('fromJson');

    // Inspect parameters
    if (namedConstructor.getParameterCount() > 0) {
      final firstParam = namedConstructor.getParameterAt(0);
      print('First parameter: ${firstParam.getName()}');
    }

    // Create instances
    final user = namedConstructor.newInstance({'json': userData});

{@endtemplate}

Inheritance
  - Object
  - PermissionManager
  - Source
  - Executable
  - Constructor
Implemented types
  - Member

## Constructors

Constructor.new()

## Properties

hashCode → int
  The hash code for this object.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited

## Methods

annotationMatches<A>(Annotation annotation) → bool
  inherited
canAcceptArguments(Map<String, dynamic> arguments) → bool
  Checks if named arguments can be accepted.
  inherited
canAcceptNamedArguments(Map<String, dynamic> arguments) → bool
  Checks if named arguments can be accepted.
  inherited
canAcceptPositionalArguments(List args) → bool
  Checks if positional arguments can be accepted.
  inherited
checkAccess(String operation, DomainPermission permission) → void
  Verifies access permissions before performing sensitive operations.
  inherited
getAllDirectAnnotations() → List<Annotation>
  Gets all annotations applied to this element.
  inherited
getDeclaration() → Declaration
  Gets the type declaration metadata for this class.
  inherited
getDeclaringClass<D>() → Class<D>
  Gets the class that declares this method.
  inherited
getDirectAnnotation<A>() → A?
  Gets a single annotation by type, if present.
  inherited
getDirectAnnotations<A>() → List<A>
  Gets all annotations of a specific type.
  inherited
getName() → String
  Gets the declared name of the source.
  inherited
getParameter(String name) → Parameter?
  Gets a parameter by name.
  inherited
getParameterAt(int index) → Parameter?
  Gets a parameter by index.
  inherited
getParameterCount() → int
  Gets the total number of parameters.
  inherited
getParameters() → List<Parameter>
  Gets all parameters of this executable element.
  inherited
getParameterTypes() → List<Class>
  Gets the types of all parameters.
  inherited
getProtectionDomain() → ProtectionDomain
  Gets the protection domain governing access to this element.
  inherited
getReturnClass() → Class<Object>
  Gets the return type of the method.
  inherited
getReturnType() → Type
  Gets the return type of the method.
  inherited
getSignature() → String
  Gets the executable signature as a string.
  inherited
hasDirectAnnotation<A>() → bool
  Checks if this element has a specific annotation.
  inherited
isConst() → bool
  Checks if this executable is declared as const.
  inherited
isFactory() → bool
  Checks if this is a factory constructor.
isPublic() → bool
  Checks if this element is public.
  inherited
newInstance<Instance>([Map<String, dynamic>? arguments, List args = const []]) → Instance
  Creates a new instance using named arguments.
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
toString() → String
  A string representation of this object.
  inherited

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited

## Static Methods

declared(ConstructorDeclaration declaration, ProtectionDomain domain) → Constructor
  Creates a Constructor instance from reflection metadata.