dart/element/element library

Defines the element model. The element model describes the semantic (as opposed to syntactic) structure of Dart code. The syntactic structure of the code is modeled by the AST structure.

The element model consists of two closely related kinds of objects: elements (instances of a subclass of Element) and types. This library defines the elements, the types are defined in type.dart.

Generally speaking, an element represents something that is declared in the code, such as a class, method, or variable. Elements are organized in a tree structure in which the children of an element are the elements that are logically (and often syntactically) part of the declaration of the parent. For example, the elements representing the methods and fields in a class are children of the element representing the class.

Every complete element structure is rooted by an instance of the class LibraryElement. A library element represents a single Dart library. Every library is defined by one or more compilation units (the library and all of its parts). The compilation units are represented by the class CompilationUnitElement and are children of the library that is defined by them. Each compilation unit can contain zero or more top-level declarations, such as classes, functions, and variables. Each of these is in turn represented as an element that is a child of the compilation unit. Classes contain methods and fields, methods can contain local variables, etc.

The element model does not contain everything in the code, only those things that are declared by the code. For example, it does not include any representation of the statements in a method body, but if one of those statements declares a local variable then the local variable will be represented by an element.

Classes

AugmentationImportElement
A library augmentation import directive within a library.
AugmentedClassElement
The result of applying augmentations to a ClassElement.
AugmentedEnumElement
The result of applying augmentations to an EnumElement.
AugmentedInterfaceElement
The result of applying augmentations to a InterfaceElement.
AugmentedMixinElement
The result of applying augmentations to a MixinElement.
BindPatternVariableElement
A pattern variable that is explicitly declared.
ClassAugmentationElement
A class augmentation, defined by a class augmentation declaration.
ClassElement
An element that represents a class or a mixin. The class can be defined by either a class declaration (with a class body), a mixin application (without a class body), a mixin declaration, or an enum declaration.
ClassMemberElement
An element that is contained within a ClassElement.
ClassOrAugmentationElement
Shared interface between ClassElement and ClassAugmentationElement.
CompilationUnitElement
An element representing a compilation unit.
ConstructorAugmentationElement
An element representing a constructor augmentation.
ConstructorElement
An element representing a constructor or a factory method defined within a class.
DeferredImportElementPrefix
ImportElementPrefix that is used together with deferred.
DirectiveUri
Meaning of a URI referenced in a directive.
DirectiveUriWithAugmentation
DirectiveUriWithSource that references a LibraryAugmentationElement.
DirectiveUriWithLibrary
DirectiveUriWithSource that references a LibraryElement.
DirectiveUriWithRelativeUri
DirectiveUriWithRelativeUriString that can be parsed into a relative URI.
DirectiveUriWithRelativeUriString
DirectiveUri for which we can get its relative URI string.
DirectiveUriWithSource
DirectiveUriWithRelativeUri that resolves to a Source.
DirectiveUriWithUnit
DirectiveUriWithSource that references a CompilationUnitElement.
Element
The base class for all of the elements in the element model. Generally speaking, the element model is a semantic model of the program that represents things that are declared with a name and hence can be referenced elsewhere in the code.
ElementAnnotation
A single annotation associated with an element.
ElementKind
The kind of elements in the element model.
ElementLocation
The location of an element within the element model.
ElementVisitor<R>
An object that can be used to visit an element structure.
EnumAugmentationElement
An enum augmentation, defined by a enum augmentation declaration.
EnumElement
An element that represents an enum.
EnumOrAugmentationElement
Shared interface between EnumElement and EnumAugmentationElement.
ExecutableElement
An element representing an executable object, including functions, methods, constructors, getters, and setters.
ExtensionElement
An element that represents an extension.
FieldAugmentationElement
A field augmentation defined within a class.
FieldElement
A field defined within a class.
FieldFormalParameterElement
A field formal parameter defined within a constructor element.
FunctionElement
A (non-method) function. This can be either a top-level function, a local function, a closure, or the initialization expression for a field or variable.
FunctionTypedElement
An element that has a FunctionType as its type.
GenericFunctionTypeElement
The pseudo-declaration that defines a generic function type.
HideElementCombinator
A combinator that causes some of the names in a namespace to be hidden when being imported.
ImportElementPrefix
Usage of a PrefixElement in an import directive.
InterfaceElement
An element that defines an InterfaceType.
InterfaceOrAugmentationElement
Shared interface between InterfaceElement and augmentations.
JoinPatternVariableElement
A pattern variable that is a join of other pattern variables, created for a logical-or patterns, or shared case bodies in switch statements.
LabelElement
A label associated with a statement.
LibraryAugmentationElement
A library augmentation.
LibraryElement
A library.
LibraryExportElement
A single export directive within a library.
LibraryImportElement
A single import directive within a library.
LibraryLanguageVersion
LibraryOrAugmentationElement
Shared interface between LibraryElement and LibraryAugmentationElement.
LocalElement
An element that can be (but is not required to be) defined within a method or function (an ExecutableElement).
LocalVariableElement
A local variable.
MethodAugmentationElement
An element that represents a method augmentation defined within a class.
MethodElement
An element that represents a method defined within a class.
MixinAugmentationElement
A class augmentation, defined by a mixin augmentation declaration.
MixinElement
An element that represents a mixin.
MixinOrAugmentationElement
Shared interface between MixinElement and MixinAugmentationElement.
MultiplyDefinedElement
A pseudo-element that represents multiple elements defined within a single scope that have the same name. This situation is not allowed by the language, so objects implementing this interface always represent an error. As a result, most of the normal operations on elements do not make sense and will return useless results.
MultiplyInheritedExecutableElement
An ExecutableElement, with the additional information of a list of ExecutableElements from which this element was composed.
NamespaceCombinator
An object that controls how namespaces are combined.
ParameterElement
A parameter defined within an executable element.
PartElement
A 'part' directive within a library.
PatternVariableElement
A pattern variable.
PrefixElement
A prefix used to import one or more libraries into another library.
PromotableElement
A variable that might be subject to type promotion. This might be a local variable or a parameter.
PropertyAccessorAugmentationElement
Augmentation of a PropertyAccessorElement.
PropertyAccessorElement
A getter or a setter. Note that explicitly defined property accessors implicitly define a synthetic field. Symmetrically, synthetic accessors are implicitly created for explicitly defined fields. The following rules apply:
PropertyInducingElement
A variable that has an associated getter and possibly a setter. Note that explicitly defined variables implicitly define a synthetic getter and that non-final explicitly defined variables implicitly define a synthetic setter. Symmetrically, synthetic fields are implicitly created for explicitly defined getters and setters. The following rules apply:
ShowElementCombinator
A combinator that cause some of the names in a namespace to be visible (and the rest hidden) when being imported.
SuperFormalParameterElement
A super formal parameter defined within a constructor element.
TopLevelVariableElement
A top-level variable.
TypeAliasElement
A type alias (typedef).
TypeDefiningElement
An element that defines a type.
TypeParameterElement
A type parameter.
TypeParameterizedElement
An element that has type parameters, such as a class or a typedef. This also includes functions and methods if support for generic methods is enabled.
UndefinedElement
A pseudo-elements that represents names that are undefined. This situation is not allowed by the language, so objects implementing this interface always represent an error. As a result, most of the normal operations on elements do not make sense and will return useless results.
UriReferencedElement
An element included into a library using some URI.
VariableElement
A variable. There are more specific subclasses for more specific kinds of variables.