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

ClassElement

An element that represents a class.

ClassMemberElement

An element that is contained within a ClassElement.

CompilationUnitElement

An element representing a compilation unit.

ConstructorElement

An element representing a constructor or a factory method defined within a class.

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

An object that can be used to visit an element structure.

ExecutableElement

An element representing an executable object, including functions, methods, constructors, getters, and setters.

ExportElement

An export directive within a library.

FieldElement

A field defined within a type.

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.

FunctionTypeAliasElement

A function type alias (typedef).

FunctionTypedElement

An element that has a FunctionType as its type.

HideElementCombinator

A combinator that causes some of the names in a namespace to be hidden when being imported.

ImportElement

A single import directive within a library.

LabelElement

A label associated with a statement.

LibraryElement

A library.

LocalElement

An element that can be (but is not required to be) defined within a method or function (an ExecutableElement).

LocalVariableElement

A local variable.

MethodElement

An element that represents a method defined within a type.

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.

PrefixElement

A prefix used to import one or more libraries into another library.

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.

TopLevelVariableElement

A top-level variable.

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.