LibraryElement class abstract

A library.

Clients may not extend, implement or mix-in this class.

Implemented types

Constructors

LibraryElement()

Properties

accessibleExtensions List<ExtensionElement>
Returns a list containing all of the extension elements accessible within this library.
no setterinherited
augmentationImports List<AugmentationImportElement>
Returns the augmentation imports specified in this library.
no setterinherited
context → AnalysisContext
Return the analysis context in which this element is defined.
no setterinherited
declaration Element
Return the declaration of this element. If the element is a view on an element, e.g. a method from an interface type, with substituted type parameters, return the corresponding element from the class, without any substitutions. If this element is already a declaration (or a synthetic element, e.g. a synthetic property accessor), return itself.
no setterinherited
definingCompilationUnit CompilationUnitElement
Return the compilation unit that defines this library.
no setterinherited
displayName String
Return the display name of this element, possibly the empty string if this element does not have a name.
no setterinherited
documentationComment String?
Return the content of the documentation comment (including delimiters) for this element, or null if this element does not or cannot have documentation.
no setterinherited
enclosingElement Element?
Return the element that either physically or logically encloses this element. This will be null if this element is a library because libraries are the top-level elements in the model.
no setterinherited
enclosingElement2 Element?
Return the element that either physically or logically encloses this element. This will be null if this element is a library because libraries are the top-level elements in the model.
no setterinherited
enclosingElement3 Element?
Return the element that either physically or logically encloses this element. This will be null if this element is a library because libraries are the top-level elements in the model.
no setterinherited
entryPoint FunctionElement?
Return the entry point for this library, or null if this library does not have an entry point. The entry point is defined to be a zero argument top-level function whose name is main.
no setter
exportedLibraries List<LibraryElement>
Return a list containing all of the libraries that are exported from this library.
no setter
exportNamespace → Namespace
The export Namespace of this library.
no setter
exports List<ExportElement>
Return a list containing all of the exports defined in this library.
no setterinherited
featureSet FeatureSet
The set of features available to this library.
no setterinherited
hasAlwaysThrows bool
Return true if this element has an annotation of the form @alwaysThrows.
no setterinherited
hasDeprecated bool
Return true if this element has an annotation of the form @deprecated or @Deprecated('..').
no setterinherited
hasDoNotStore bool
Return true if this element has an annotation of the form @doNotStore.
no setterinherited
hasFactory bool
Return true if this element has an annotation of the form @factory.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasInternal bool
Return true if this element has an annotation of the form @internal.
no setterinherited
hasIsTest bool
Return true if this element has an annotation of the form @isTest.
no setterinherited
hasIsTestGroup bool
Return true if this element has an annotation of the form @isTestGroup.
no setterinherited
hasJS bool
Return true if this element has an annotation of the form @JS(..).
no setterinherited
hasLiteral bool
Return true if this element has an annotation of the form @literal.
no setterinherited
hasMustBeOverridden bool
Return true if this element has an annotation of the form @mustBeOverridden.
no setterinherited
hasMustCallSuper bool
Return true if this element has an annotation of the form @mustCallSuper.
no setterinherited
hasNonVirtual bool
Return true if this element has an annotation of the form @nonVirtual.
no setterinherited
hasOptionalTypeArgs bool
Return true if this element has an annotation of the form @optionalTypeArgs.
no setterinherited
hasOverride bool
Return true if this element has an annotation of the form @override.
no setterinherited
hasProtected bool
Return true if this element has an annotation of the form @protected.
no setterinherited
hasRequired bool
Return true if this element has an annotation of the form @required.
no setterinherited
hasSealed bool
Return true if this element has an annotation of the form @sealed.
no setterinherited
hasUseResult bool
Return true if this element has an annotation of the form @useResult or @UseResult('..').
no setterinherited
hasVisibleForOverriding bool
Return true if this element has an annotation of the form @visibleForOverriding.
no setterinherited
hasVisibleForTemplate bool
Return true if this element has an annotation of the form @visibleForTemplate.
no setterinherited
hasVisibleForTesting bool
Return true if this element has an annotation of the form @visibleForTesting.
no setterinherited
id int
The unique integer identifier of this element.
no setterinherited
identifier String
Return an identifier that uniquely identifies this element among the children of this element's parent.
no setter
importedLibraries List<LibraryElement>
Return a list containing all of the libraries that are imported into this library. This includes all of the libraries that are imported using a prefix and those that are imported without a prefix.
no setter
imports List<ImportElement>
Return a list containing all of the imports defined in this library.
no setterinherited
isBrowserApplication bool
Return true if this library is an application that can be run in the browser.
no setter
isDartAsync bool
Return true if this library is the dart:async library.
no setter
isDartCore bool
Return true if this library is the dart:core library.
no setter
isInSdk bool
Return true if this library is part of the SDK.
no setter
isNonNullableByDefault bool
no setterinherited
isPrivate bool
Return true if this element is private. Private elements are visible only within the library in which they are declared.
no setterinherited
isPublic bool
Return true if this element is public. Public elements are visible within any library that imports the library in which they are declared.
no setterinherited
isSynthetic bool
Return true if this element is synthetic. A synthetic element is an element that is not represented in the source code explicitly, but is implied by the source code, such as the default constructor for a class that does not explicitly define any constructors.
no setterinherited
kind ElementKind
Return the kind of element that this is.
no setterinherited
languageVersion LibraryLanguageVersion
The language version for this library.
no setterinherited
library LibraryElement
Return the library that contains this element. This will be the element itself if it is a library element. This will be null if this element is MultiplyDefinedElement that is not contained in a library.
no setterinherited
libraryExports List<LibraryExportElement>
Return a list containing all of the exports defined in this library.
no setterinherited
libraryImports List<LibraryImportElement>
Return a list containing all of the imports defined in this library.
no setterinherited
librarySource → Source
If this target is associated with a library, return the source of the library's defining compilation unit; otherwise return null.
no setterinherited
loadLibraryFunction FunctionElement
Return the element representing the synthetic function loadLibrary that is implicitly defined for this library if the library is imported using a deferred import.
no setter
location ElementLocation?
Return an object representing the location of this element in the element model. The object can be used to locate this element at a later time.
no setterinherited
metadata List<ElementAnnotation>
Return a list containing all of the metadata associated with this element. The array will be empty if the element does not have any metadata or if the library containing this element has not yet been resolved.
no setterinherited
name String
Return the name of this library, possibly the empty string if this library does not have an explicit name.
no setteroverride
nameLength int
Return 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
Return 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
nonSynthetic Element
Return the non-synthetic element that caused this element to be created.
no setterinherited
parts List<CompilationUnitElement>
Return a list containing all of the compilation units that are included in this library using a part directive. This does not include the defining compilation unit that contains the part directives.
no setter
parts2 List<PartElement>
Returns the list of part directives of this library.
no setter
prefixes List<PrefixElement>
Return a list containing elements for each of the prefixes used to import libraries into this library. Each prefix can be used in more than one import directive.
no setterinherited
publicNamespace → Namespace
The public Namespace of this library.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope Scope
Return the name lookup scope for this library. It consists of elements that are either declared in the library, or imported into it.
no setterinherited
session AnalysisSession
Return the analysis session in which this element is defined.
no setterinherited
source → Source
Return the source associated with this target, or null if this target is not associated with a source.
no setterinherited
topLevelElements Iterable<Element>
Return the top-level elements defined in each of the compilation units that are included in this library. This includes both public and private elements, but does not include imports, exports, or synthetic elements.
no setter
typeProvider TypeProvider
Return the TypeProvider that is used in this library.
no setterinherited
typeSystem TypeSystem
Return the TypeSystem that is used in this library.
no setterinherited
units List<CompilationUnitElement>
Return a list containing all of the compilation units this library consists of. This includes the defining compilation unit and units included using the part directive.
no setter

Methods

accept<T>(ElementVisitor<T> visitor) → T?
Use the given visitor to visit this element. Return the value returned by the visitor as a result of visiting this element.
inherited
getClass(String name) ClassElement?
Return the class defined in this library that has the given name, or null if this library does not define a class with the given name.
getDisplayString({required bool withNullability, bool multiline = false}) String
Return the presentation of this element as it should appear when presented to users.
inherited
getExtendedDisplayName(String? shortName) String
Return a display name for the given element that includes the path to the compilation unit in which the type is defined. If shortName is null then displayName will be used as the name of this element. Otherwise the provided name will be used.
inherited
getImportsWithPrefix(PrefixElement prefix) List<ImportElement>
Return a list containing all of the imports that share the given prefix, or an empty array if there are no such imports.
getType(String className) ClassElement?
Return the class defined in this library that has the given name, or null if this library does not define a class with the given name.
isAccessibleIn(LibraryElement? library) bool
Return true if this element, assuming that it is within scope, is accessible to code in the given library. This is defined by the Dart Language Specification in section 3.2:
inherited
isAccessibleIn2(LibraryElement library) bool
Return true if this element, assuming that it is within scope, is accessible to code in the given library. This is defined by the Dart Language Specification in section 6.2:
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
thisOrAncestorMatching<E extends Element>(bool predicate(Element)) → E?
Return either this element or the most immediate ancestor of this element for which the predicate returns true, or null if there is no such element.
inherited
thisOrAncestorOfType<E extends Element>() → E?
Return either this element or the most immediate ancestor of this element that has the given type, or null if there is no such element.
inherited
toLegacyElementIfOptOut<T extends Element>(T element) → T
If a legacy library, return the legacy view on the element. Otherwise, return the original element.
toLegacyTypeIfOptOut(DartType type) DartType
If a legacy library, return the legacy version of the type. Otherwise, return the original type.
toString() String
A string representation of this object.
inherited
visitChildren(ElementVisitor visitor) → void
Use the given visitor to visit all of the children of this element. There is no guarantee of the order in which the children will be visited.
inherited

Operators

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