LibraryElement class abstract

A library.

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

Implemented types

Constructors

LibraryElement()

Properties

accessibleExtensions List<ExtensionElement>
The extension elements accessible within this library.
no setterinherited
children List<Element>
A list of this element's children.
no setterinherited
context → AnalysisContext
The analysis context in which this element is defined.
no setterinherited
declaration Element
The declaration of this element.
no setterinherited
definingCompilationUnit CompilationUnitElement
The compilation unit that defines this library.
no setterinherited
displayName String
The display name of this element, possibly the empty string if the element does not have a name.
no setterinherited
documentationComment String?
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?
The element that either physically or logically encloses this element.
no setterinherited
enclosingElement3 Null
Returns null, because libraries are the top-level elements in the model.
no setteroverride
entryPoint FunctionElement?
The entry point for this library, or null if this library does not have an entry point.
no setter
exportedLibraries List<LibraryElement>
The libraries that are exported from this library.
no setter
exportNamespace → Namespace
The export Namespace of this library.
no setter
featureSet FeatureSet
The set of features available to this library.
no setterinherited
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
hasDoNotSubmit bool
Whether the element has an annotation of the form @doNotSubmit.
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 setterinherited
hasImmutable bool
Whether the element has an annotation of the form @immutable.
no setterinherited
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
hasJS bool
Whether the element has an annotation of the form @JS(..).
no setterinherited
hasLiteral bool
Whether the element has an annotation of the form @literal.
no setterinherited
hasMustBeConst bool
Whether the element has an annotation of the form @mustBeConst.
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
hasVisibleForTemplate bool
Whether the element has an annotation of the form @visibleForTemplate.
no setterinherited
hasVisibleForTesting bool
Whether the element has an annotation of the form @visibleForTesting.
no setterinherited
hasVisibleOutsideTemplate bool
Whether the element has an annotation of the form @visibleOutsideTemplate.
no setterinherited
id int
The unique integer identifier of this element.
no setterinherited
identifier String
The identifier that uniquely identifies this element among the children of this element's parent.
no setter
importedLibraries List<LibraryElement>
The libraries that are imported into this library.
no setter
isBrowserApplication bool
Whether the library is an application that can be run in the browser.
no setter
isDartAsync bool
Whether the library is the dart:async library.
no setter
isDartCore bool
Whether the library is the dart:core library.
no setter
isInSdk bool
Whether the library is part of the SDK.
no setter
isNonNullableByDefault bool
no setterinherited
isPrivate bool
Whether the element is private.
no setterinherited
isPublic bool
Whether the element is public.
no setterinherited
isSynthetic bool
Whether the element is synthetic.
no setterinherited
kind ElementKind
The kind of element that this is.
no setterinherited
languageVersion LibraryLanguageVersion
The language version for this library.
no setterinherited
library LibraryElement
Library that contains this element.
no setterinherited
libraryExports List<LibraryExportElement>
The exports defined in this library.
no setterinherited
libraryImports List<LibraryImportElement>
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
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?
The location of this element in the element model.
no setterinherited
metadata List<ElementAnnotation>
All of the metadata associated with this element.
no setterinherited
name String
The name of this library, possibly the empty string if this library does not have an explicit name.
no setteroverride
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
nonSynthetic Element
The non-synthetic element that caused this element to be created.
no setterinherited
parts List<PartElement>
The list of part directives of this library.
no setter
prefixes List<PrefixElement>
The prefixes used to import libraries into this library.
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
The name lookup scope for this library.
no setterinherited
session AnalysisSession
The analysis session in which this element is defined.
no setterinherited
sinceSdkVersion → Version?
The version where this SDK API was added.
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>
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
The TypeProvider that is used in this library.
no setterinherited
typeSystem TypeSystem
The TypeSystem that is used in this library.
no setterinherited
units List<CompilationUnitElement>
The compilation units this library consists of.
no setter

Methods

accept<T>(ElementVisitor<T> visitor) → T?
Uses the given visitor to visit this element.
inherited
getClass(String name) ClassElement?
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({bool withNullability = true, bool multiline = false}) String
Returns the presentation of this element as it should appear when presented to users.
inherited
getExtendedDisplayName(String? shortName) String
Returns 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
isAccessibleIn(LibraryElement library) bool
Whether the element, assuming that it is within scope, is accessible to code in the given library.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
thisOrAncestorMatching<E extends Element>(bool predicate(Element)) → E?
Returns 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
thisOrAncestorMatching3<E extends Element>(bool predicate(Element)) → E?
Returns 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?
Returns 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
thisOrAncestorOfType3<E extends Element>() → E?
Returns 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, returns the legacy view on the 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
Uses 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