ClassElement class abstract

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.

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

Implemented types

Constructors

ClassElement()

Properties

accessors List<PropertyAccessorElement>
The declared accessors (getters and setters).
read-onlyinherited
allSupertypes List<InterfaceType>
All the supertypes defined for this element and its supertypes.
read-onlyinherited
augmentation ClassElement?
The immediate augmentation of this element, or null if there are no augmentations.
read-onlyoverride
augmentationTarget ClassElement?
The element that is augmented by this augmentation; or null if isAugmentation is false, or there is no corresponding element to be augmented.
read-onlyoverride
augmented AugmentedClassElement?
The result of applying augmentations.
read-onlyoverride
children List<Element>
A list of this element's children.
read-onlyinherited
constructors List<ConstructorElement>
The declared constructors.
read-onlyinherited
context → AnalysisContext
The analysis context in which this element is defined.
read-onlyinherited
declaration Element
The declaration of this element.
read-onlyinherited
displayName String
The display name of this element, possibly the empty string if the element does not have a name.
read-onlyinherited
documentationComment String?
The content of the documentation comment (including delimiters) for this element, or null if this element does not or cannot have documentation.
read-onlyinherited
enclosingElement CompilationUnitElement
The element that either physically or logically encloses this element.
read-onlyinherited
fields List<FieldElement>
The declared fields.
read-onlyinherited
hasAlwaysThrows bool
Whether the element has an annotation of the form @alwaysThrows.
read-onlyinherited
hasDeprecated bool
Whether the element has an annotation of the form @deprecated or @Deprecated('..').
read-onlyinherited
hasDoNotStore bool
Whether the element has an annotation of the form @doNotStore.
read-onlyinherited
hasFactory bool
Whether the element has an annotation of the form @factory.
read-onlyinherited
hashCode int
The hash code for this object.
read-onlyinherited
hasInternal bool
Whether the element has an annotation of the form @internal.
read-onlyinherited
hasIsTest bool
Whether the element has an annotation of the form @isTest.
read-onlyinherited
hasIsTestGroup bool
Whether the element has an annotation of the form @isTestGroup.
read-onlyinherited
hasJS bool
Whether the element has an annotation of the form @JS(..).
read-onlyinherited
hasLiteral bool
Whether the element has an annotation of the form @literal.
read-onlyinherited
hasMustBeOverridden bool
Whether the element has an annotation of the form @mustBeOverridden.
read-onlyinherited
hasMustCallSuper bool
Whether the element has an annotation of the form @mustCallSuper.
read-onlyinherited
hasNonFinalField bool
Whether the class or its superclass declares a non-final instance field.
read-only
hasNonVirtual bool
Whether the element has an annotation of the form @nonVirtual.
read-onlyinherited
hasOptionalTypeArgs bool
Whether the element has an annotation of the form @optionalTypeArgs.
read-onlyinherited
hasOverride bool
Whether the element has an annotation of the form @override.
read-onlyinherited
hasProtected bool
Whether the element has an annotation of the form @protected.
read-onlyinherited
hasReopen bool
Whether the element has an annotation of the form @reopen.
read-onlyinherited
hasRequired bool
Whether the element has an annotation of the form @required.
read-onlyinherited
hasSealed bool
Whether the element has an annotation of the form @sealed.
read-onlyinherited
hasUseResult bool
Whether the element has an annotation of the form @useResult or @UseResult('..').
read-onlyinherited
hasVisibleForOverriding bool
Whether the element has an annotation of the form @visibleForOverriding.
read-onlyinherited
hasVisibleForTemplate bool
Whether the element has an annotation of the form @visibleForTemplate.
read-onlyinherited
hasVisibleForTesting bool
Whether the element has an annotation of the form @visibleForTesting.
read-onlyinherited
hasVisibleOutsideTemplate bool
Whether the element has an annotation of the form @visibleOutsideTemplate.
read-onlyinherited
id int
The unique integer identifier of this element.
read-onlyinherited
interfaces List<InterfaceType>
The interfaces that are implemented by this class.
read-onlyinherited
isAbstract bool
Whether the class is abstract. A class is abstract if it has an explicit abstract modifier. Note, that this definition of abstract is different from has unimplemented members.
read-only
isAugmentation bool
Whether the element is an augmentation.
read-onlyinherited
isBase bool
Whether this class is a base class.
read-only
isConstructable bool
Whether the class can be instantiated.
read-only
isDartCoreEnum bool
Whether the class represents the class 'Enum' defined in dart:core.
read-only
isDartCoreObject bool
Whether the class represents the class 'Object' defined in dart:core.
read-only
isExhaustive bool
Whether the class has the property where, in a switch, if you cover all of the subtypes of this element, then the compiler knows that you have covered all possible instances of the type.
read-only
isFinal bool
Whether the class is a final class.
read-only
isInline bool
Whether the class is an inline class.
read-only
isInterface bool
Whether the class is an interface class.
read-only
isMixinApplication bool
Whether the class is a mixin application.
read-only
isMixinClass bool
Whether the class is a mixin class.
read-only
isPrivate bool
Whether the element is private.
read-onlyinherited
isPublic bool
Whether the element is public.
read-onlyinherited
isSealed bool
Whether the class is a sealed class.
read-only
isSimplyBounded bool
If the element defines a type, indicates whether the type may safely appear without explicit type parameters as the bounds of a type parameter declaration.
read-onlyinherited
isSynthetic bool
Whether the element is synthetic.
read-onlyinherited
isValidMixin bool
Whether the class can validly be used as a mixin when defining another class.
read-only
kind ElementKind
The kind of element that this is.
read-onlyinherited
library LibraryElement
Tibrary that contains this element.
read-onlyinherited
librarySource → Source
If this target is associated with a library, return the source of the library's defining compilation unit; otherwise return null.
read-onlyinherited
location ElementLocation?
The location of this element in the element model.
read-onlyinherited
metadata List<ElementAnnotation>
All of the metadata associated with this element.
read-onlyinherited
methods List<MethodElement>
The declared methods.
read-onlyinherited
mixins List<InterfaceType>
The mixins that are applied to the class being extended in order to derive the superclass of this class.
read-onlyinherited
name String
The name of this element, or null if this element does not have a name.
read-onlyinherited
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.
read-onlyinherited
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.
read-onlyinherited
nonSynthetic Element
The non-synthetic element that caused this element to be created.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
session AnalysisSession?
The analysis session in which this element is defined.
read-onlyinherited
sinceSdkVersion → Version?
The version where this SDK API was added.
read-onlyinherited
source → Source
Return the source associated with this target, or null if this target is not associated with a source.
read-onlyinherited
supertype InterfaceType?
The superclass of this element.
read-onlyinherited
thisType InterfaceType
The type of this expression.
read-onlyinherited
typeParameters List<TypeParameterElement>
The type parameters declared by this element directly.
read-onlyinherited
unnamedConstructor ConstructorElement?
The unnamed constructor declared directly in this class.
read-onlyinherited

Methods

accept<T>(ElementVisitor<T> visitor) → T?
Uses the given visitor to visit this element.
inherited
getDisplayString({required bool withNullability, 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
getField(String name) FieldElement?
The field (synthetic or explicit) defined directly in this class or augmentation that has the given name. TODO(scheglov) Deprecate and remove it.
inherited
getGetter(String name) PropertyAccessorElement?
The getter (synthetic or explicit) defined directly in this class or augmentation that has the given name. TODO(scheglov) Deprecate and remove it.
inherited
getMethod(String name) MethodElement?
The method defined directly in this class or augmentation that has the given name. TODO(scheglov) Deprecate and remove it.
inherited
getNamedConstructor(String name) ConstructorElement?
The constructor defined directly in this class or augmentation that has the given name. TODO(scheglov) Deprecate and remove it.
inherited
getSetter(String name) PropertyAccessorElement?
The setter (synthetic or explicit) defined directly in this class or augmentation that has the given name. TODO(scheglov) Deprecate and remove it.
inherited
instantiate({required List<DartType> typeArguments, required NullabilitySuffix nullabilitySuffix}) InterfaceType
Create the InterfaceType for this element with the given typeArguments and nullabilitySuffix.
inherited
isAccessibleIn(LibraryElement library) bool
Whether the element, assuming that it is within scope, is accessible to code in the given library.
inherited
isExtendableIn(LibraryElement library) bool
Whether the class, assuming that it is within scope, is extendable to classes in the given library.
isImplementableIn(LibraryElement library) bool
Whether the class, assuming that it is within scope, is implementable to classes, mixins, and enums in the given library.
isMixableIn(LibraryElement library) bool
Whether the class, assuming that it is within scope, is able to be mixed-in by classes and enums in the given library.
lookUpConcreteMethod(String methodName, LibraryElement library) MethodElement?
Returns the element representing the method that results from looking up the given methodName in this class with respect to the given library, ignoring abstract methods, or null if the look up fails.
inherited
lookUpGetter(String getterName, LibraryElement library) PropertyAccessorElement?
Returns the element representing the getter that results from looking up the given getterName in this class with respect to the given library, or null if the look up fails.
inherited
lookUpInheritedConcreteGetter(String getterName, LibraryElement library) PropertyAccessorElement?
Returns the element representing the getter that results from looking up the given getterName in the superclass of this class with respect to the given library, ignoring abstract getters, or null if the look up fails.
inherited
lookUpInheritedConcreteMethod(String methodName, LibraryElement library) MethodElement?
Returns the element representing the method that results from looking up the given methodName in the superclass of this class with respect to the given library, ignoring abstract methods, or null if the look up fails.
inherited
lookUpInheritedConcreteSetter(String setterName, LibraryElement library) PropertyAccessorElement?
Returns the element representing the setter that results from looking up the given setterName in the superclass of this class with respect to the given library, ignoring abstract setters, or null if the look up fails.
inherited
lookUpInheritedMethod(String methodName, LibraryElement library) MethodElement?
Returns the element representing the method that results from looking up the given methodName in the superclass of this class with respect to the given library, or null if the look up fails.
inherited
lookUpMethod(String methodName, LibraryElement library) MethodElement?
Returns the element representing the method that results from looking up the given methodName in this class with respect to the given library, or null if the look up fails.
inherited
lookUpSetter(String setterName, LibraryElement library) PropertyAccessorElement?
Returns the element representing the setter that results from looking up the given setterName in this class with respect to the given library, or null if the look up fails.
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
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
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