ConstructorElementImpl class
Implementation of a constructor element in a Dart class.
This class represents constructors that create instances of classes. It provides implementations for constructor-specific functionality such as handling redirecting constructors, superclass constructor calls, and different constructor types (const, factory, etc.).
- Inheritance
-
- Object
- ElementImpl
- ExecutableElementImpl
- ConstructorElementImpl
- Implemented types
Constructors
- ConstructorElementImpl({required String name, required Element enclosingElement, required bool isConst, required bool isFactory, required bool isGenerator, ConstructorElementRef? superConstructor})
- Creates a constructor element with the specified properties.
Properties
-
allTypeParameters
→ List<
TypeParameterType> -
Returns all type parameters of this element and its enclosing elements.
no setterinherited
- codeLength → int
-
The length of the code of this element in the file that contains the
no setterinherited
- codeOffset → int
-
The offset of the code of this element in the file that contains the
no setterinherited
- didResolveMetadata ↔ bool
-
Whether the metadata of this element has been resolved.
getter/setter pairinherited
- documentationComment ↔ String?
-
The documentation comment associated with this element if it has one.
getter/setter pairinherited
- enclosingElement → Element
-
The enclosing element of this element.
finalinherited
- hasAlwaysThrows → bool
-
Whether the element has an annotation of the form
@alwaysThrows.no setterinherited - hasDeprecated → bool
-
Whether the element has an annotation of the form
@deprecatedor@Deprecated('..').no setterinherited - hasDoNotStore → bool
-
Whether the element has an annotation of the form
@doNotStore.no setterinherited - hasFactory → bool
-
Whether the element has an annotation of the form
@factory.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- hasImplicitReturnType → bool
-
Whether the executable element did not have an explicit return type
specified for it in the original source.
no setterinherited
- hasInternal → bool
-
Whether the element has an annotation of the form
@internal.no setterinherited - hasIsTest → bool
-
Whether the element has an annotation of the form
@isTest.no setterinherited - hasIsTestGroup → bool
-
Whether the element has an annotation of the form
@isTestGroup.no setterinherited - hasLiteral → bool
-
Whether the element has an annotation of the form
@literal.no setterinherited - hasMustBeOverridden → bool
-
Whether the element has an annotation of the form
@mustBeOverridden.no setterinherited - hasMustCallSuper → bool
-
Whether the element has an annotation of the form
@mustCallSuper.no setterinherited - hasNonVirtual → bool
-
Whether the element has an annotation of the form
@nonVirtual.no setterinherited - hasOptionalTypeArgs → bool
-
Whether the element has an annotation of the form
@optionalTypeArgs.no setterinherited - hasOverride → bool
-
Whether the element has an annotation of the form
@override.no setterinherited - hasProtected → bool
-
Whether the element has an annotation of the form
@protected.no setterinherited - hasRedeclare → bool
-
Whether the element has an annotation of the form
@redeclare.no setterinherited - hasReopen → bool
-
Whether the element has an annotation of the form
@reopen.no setterinherited - hasRequired → bool
-
Whether the element has an annotation of the form
@required.no setterinherited - hasSealed → bool
-
Whether the element has an annotation of the form
@sealed.no setterinherited - hasUseResult → bool
-
Whether the element has an annotation of the form
@useResultor@UseResult('..').no setterinherited - hasVisibleForOverriding → bool
-
Whether the element has an annotation of the form
@visibleForOverriding.no setterinherited - identifier → String
-
A String that uniquely identifies this element
no setterinherited
- isAbstract → bool
-
Whether the executable element is abstract.
finalinherited
- isAsynchronous → bool
-
Whether the executable element has body marked as being asynchronous.
finalinherited
- isConst → bool
-
Whether the constructor is a constant constructor.
final
- isDefaultConstructor → bool
-
Whether the constructor can be used as a default constructor - unnamed,
and has no required parameters.
no setteroverride
- isExternal → bool
-
Whether the executable element is external.
finalinherited
- isFactory → bool
-
Whether the constructor represents a factory constructor.
final
- isGenerative → bool
-
Whether the constructor represents a generative constructor.
no setteroverride
- isGenerator → bool
-
Whether the executable element has a body marked as being a generator.
finalinherited
- isOperator → bool
-
Whether the executable element is an operator.
finalinherited
- isPrivate → bool
-
Whether the name of this element starts with an underscore.
no setterinherited
- isPublic → bool
-
Whether the name of this element does not start with an underscore.
no setterinherited
- isStatic → bool
-
Whether the element is a static element.
finalinherited
- isSynchronous → bool
-
Whether the executable element has a body marked as being synchronous.
finalinherited
- library → LibraryElement
-
The library that contains this element.
no setterinherited
- librarySrc → Asset
-
The source code location of this element.
no setterinherited
-
metadata
→ List<
ElementAnnotation> -
The metadata associated with this element.
no setterinherited
- metadataResolveCallback ↔ void Function()?
-
Callback to resolve metadata.
getter/setter pairinherited
- name → String
-
The name of the element.
finalinherited
- nameLength → int
-
The length of the name of this element in the file that contains the
declaration of this element, or
0if this element does not have a name.no setterinherited - nameOffset → int
-
The offset of the name of this element in the file that contains the
declaration of this element, or
-1if this element is synthetic, does not have a name, or otherwise does not have an offset.no setterinherited -
parameters
→ List<
ParameterElement> -
The parameters defined by this executable element.
no setterinherited
- redirectedConstructor ↔ ConstructorElementRef?
-
The constructor to which this constructor is redirecting, or
nullif this constructor does not redirect to another constructor or if the library containing this constructor has not yet been resolved.getter/setter pairoverride-getter - returnType ↔ DartType
-
The return type defined by this element.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → String?
-
The source code of this element.
no setterinherited
- superConstructor → ConstructorElementRef?
-
The constructor of the superclass that this constructor invokes, or
nullif this constructor redirects to another constructor, or if the library containing this constructor has not yet been resolved.final - type ↔ FunctionType
-
The type defined by this element.
getter/setter pairinherited
-
typeParameters
→ List<
TypeParameterType> -
The type parameters of this element.
no setterinherited
Methods
-
addMetadata(
ElementAnnotation annotation) → void -
Adds a metadata annotation to this element.
inherited
-
addParameter(
ParameterElement parameter) → void -
Adds a parameter to this executable element's parameter list.
inherited
-
addTypeParameter(
TypeParameterType typeParameter) → void -
Adds a type parameter to this element.
inherited
-
getAnnotation(
String name) → ElementAnnotation? -
Returns the first annotation with the given name, or null if no such
inherited
-
getParameter(
String name) → ParameterElement? -
Retrieves a parameter by name from this executable's parameter list.
inherited
-
instantiate(
NamedDartType typeRef) → DartType -
instantiates the type parameters of this element with the given type
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCodeRange(
AstNode? node, int offset, int length) → void -
Sets the code range for this element.
inherited
-
setNameRange(
int offset, int length) → void -
Sets the name range for this element.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited