Element class abstract

The base class for all elements in the Dart language.

Elements represent the building blocks of a Dart program, such as classes, methods, fields, and variables. They provide a way to access information about the structure and semantics of the code.

This class provides a common interface for accessing properties like the element's name, enclosing element, library, and metadata. It also defines methods for checking the presence of specific annotations.

Implementers

Constructors

Element.new()

Properties

codeLength int
The length of the code of this element in the file that contains the
no setter
codeOffset int
The offset of the code of this element in the file that contains the
no setter
documentationComment String?
The documentation comment associated with this element if it has one.
no setter
enclosingElement Element?
The enclosing element of this element.
no setter
hasAlwaysThrows bool
Whether the element has an annotation of the form @alwaysThrows.
no setter
hasDeprecated bool
Whether the element has an annotation of the form @deprecated or @Deprecated('..').
no setter
hasDoNotStore bool
Whether the element has an annotation of the form @doNotStore.
no setter
hasFactory bool
Whether the element has an annotation of the form @factory.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasInternal bool
Whether the element has an annotation of the form @internal.
no setter
hasIsTest bool
Whether the element has an annotation of the form @isTest.
no setter
hasIsTestGroup bool
Whether the element has an annotation of the form @isTestGroup.
no setter
hasLiteral bool
Whether the element has an annotation of the form @literal.
no setter
hasMustBeOverridden bool
Whether the element has an annotation of the form @mustBeOverridden.
no setter
hasMustCallSuper bool
Whether the element has an annotation of the form @mustCallSuper.
no setter
hasNonVirtual bool
Whether the element has an annotation of the form @nonVirtual.
no setter
hasOptionalTypeArgs bool
Whether the element has an annotation of the form @optionalTypeArgs.
no setter
hasOverride bool
Whether the element has an annotation of the form @override.
no setter
hasProtected bool
Whether the element has an annotation of the form @protected.
no setter
hasRedeclare bool
Whether the element has an annotation of the form @redeclare.
no setter
hasReopen bool
Whether the element has an annotation of the form @reopen.
no setter
hasRequired bool
Whether the element has an annotation of the form @required.
no setter
hasSealed bool
Whether the element has an annotation of the form @sealed.
no setter
hasUseResult bool
Whether the element has an annotation of the form @useResult or @UseResult('..').
no setter
hasVisibleForOverriding bool
Whether the element has an annotation of the form @visibleForOverriding.
no setter
identifier String
A String that uniquely identifies this element
no setter
isPrivate bool
Whether the name of this element starts with an underscore.
no setter
isPublic bool
Whether the name of this element does not start with an underscore.
no setter
library LibraryElement
The library that contains this element.
no setter
librarySrc Asset
The source code location of this element.
no setter
metadata List<ElementAnnotation>
The metadata associated with this element.
no setter
name String
The name of the element.
no setter
nameLength int
The length of the name of this element in the file that contains the declaration of this element, or 0 if this element does not have a name.
no setter
nameOffset int
The offset of the name of this element in the file that contains the declaration of this element, or -1 if this element is synthetic, does not have a name, or otherwise does not have an offset.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String?
The source code of this element.
no setter

Methods

getAnnotation(String name) ElementAnnotation?
Returns the first annotation with the given name, or null if no such
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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