LibraryElementImpl class

Implementation for LibraryElement.

This class provides methods for accessing the classes, mixins, enums, functions, and type aliases defined in a library.

Inheritance
Implemented types

Constructors

LibraryElementImpl(ResolverImpl resolver, CompilationUnit compilationUnit, {required Asset src})
Creates an instance of LibraryElementImpl.

Properties

classes → List<ClassElementImpl>
The classes in this library.
no setteroverride
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
compilationUnit → CompilationUnit
The compilation unit of this library.
final
didResolveMetadata ↔ bool
Whether the metadata of this element has been resolved.
getter/setter pairinherited
directives → List<DirectiveElement>
The directives in this library.
no setteroverride
documentationComment ↔ String?
The documentation comment associated with this element if it has one.
getter/setter pairinherited
enclosingElement → Null
The enclosing element of this element.
no setteroverride
enums → List<EnumElementImpl>
The enums in this library.
no setteroverride
functions → List<FunctionElement>
The functions in this library.
no setteroverride
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 @deprecated or @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 setteroverride
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 @useResult or @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
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
library → LibraryElement
The library that contains this element.
no setteroverride
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
mixins → List<MixinElementImpl>
The mixins in this library.
no setteroverride
name → String
The name of the element.
latefinal
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 setterinherited
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 setterinherited
resolvedElements → List<Element>
The list of elements that have been resolved in this library.
no setter
resolver → ResolverImpl
The resolver for this library.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
source → String
The source code of this element.
no setteroverride
src → Asset
The source code of this library.
final
typeAliases → List<TypeAliasElement>
The type aliases in this library.
no setteroverride

Methods

addElement(Element element) → void
Adds an element to the library.
addMetadata(ElementAnnotation annotation) → void
Adds a metadata annotation to this element.
inherited
annotatedWith(TypeChecker checker) → Iterable<AnnotatedElement>
All of the resolved declarations in this library annotated with checker.
override
annotatedWithExact(TypeChecker checker) → Iterable<AnnotatedElement>
All of the resolved declarations in this library annotated with exactly checker.
override
buildDeclarationRef(String identifier, ReferenceType type) → DeclarationRef
Builds a declaration reference for the given identifier and type.
override
getAnnotation(String name) → ElementAnnotation?
Returns the first annotation with the given name, or null if no such
inherited
getClass(String name) → ClassElementImpl?
Returns the class with the given name, or null if this library does not have a class with the given name.
override
getElement(String name) → Element?
Returns the element with the given name, or null if this library does not have an element with the given name.
override
getEnum(String name) → EnumElementImpl?
Returns the enum with the given name, or null if this library does not have an enum with the given name.
override
getFunction(String name) → FunctionElement?
Returns the function with the given name, or null if this library does not have a function with the given name.
override
getMixin(String name) → MixinElementImpl?
Returns the mixin with the given name, or null if this library does not have a mixin with the given name.
override
getTypeAlias(String name) → TypeAliasElement?
Returns the type alias with the given name, or null if this library does not have a type alias with the given name.
override
hasElement(String name) → bool
Checks if the library has an element with the given name.
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.
inherited

Operators

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