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).
no setterinherited
allSupertypes List<InterfaceType>
All the supertypes defined for this element and its supertypes.
no setterinherited
augmentation ClassElement?
The immediate augmentation of this element, or null if there are no augmentations.
no setteroverride
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.
no setteroverride
augmented AugmentedClassElement?
The result of applying augmentations.
no setteroverride
children List<Element>
A list of this element's children.
no setterinherited
constructors List<ConstructorElement>
The declared constructors.
no setterinherited
context → AnalysisContext
The analysis context in which this element is defined.
no setterinherited
declaration Element
The declaration of this element.
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 CompilationUnitElement
The element that either physically or logically encloses this element.
no setterinherited
fields List<FieldElement>
The declared fields.
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
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
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
hasNonFinalField bool
Whether the class or its superclass declares a non-final instance field.
no setter
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
interfaces List<InterfaceType>
The interfaces that are implemented by this class.
no setterinherited
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.
no setter
isAugmentation bool
Whether the element is an augmentation.
no setterinherited
isBase bool
Whether this class is a base class.
no setter
isConstructable bool
Whether the class can be instantiated.
no setter
isDartCoreEnum bool
Whether the class represents the class 'Enum' defined in dart:core.
no setter
isDartCoreObject bool
Whether the class represents the class 'Object' defined in dart:core.
no setter
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.
no setter
isFinal bool
Whether the class is a final class.
no setter
isInline bool
Whether the class is an inline class.
no setter
isInterface bool
Whether the class is an interface class.
no setter
isMixinApplication bool
Whether the class is a mixin application.
no setter
isMixinClass bool
Whether the class is a mixin class.
no setter
isPrivate bool
Whether the element is private.
no setterinherited
isPublic bool
Whether the element is public.
no setterinherited
isSealed bool
Whether the class is a sealed class.
no setter
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.
no setterinherited
isSynthetic bool
Whether the element is synthetic.
no setterinherited
isValidMixin bool
Whether the class can validly be used as a mixin when defining another class.
no setter
kind ElementKind
The kind of element that this is.
no setterinherited
library LibraryElement
Library that contains this element.
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
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
methods List<MethodElement>
The declared methods.
no setterinherited
mixins List<InterfaceType>
The mixins that are applied to the class being extended in order to derive the superclass of this class.
no setterinherited
name String
The name of this element, or null if this element does not have a name.
no setterinherited
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
runtimeType Type
A representation of the runtime type of the object.
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
supertype InterfaceType?
The superclass of this element.
no setterinherited
thisType InterfaceType
The type of this expression.
no setterinherited
typeParameters List<TypeParameterElement>
The type parameters declared by this element directly.
no setterinherited
unnamedConstructor ConstructorElement?
The unnamed constructor declared directly in this class.
no setterinherited

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.
inherited
getGetter(String name) PropertyAccessorElement?
The getter (synthetic or explicit) defined directly in this class or augmentation that has the given name.
inherited
getMethod(String name) MethodElement?
The method defined directly in this class or augmentation that has the given name.
inherited
getNamedConstructor(String name) ConstructorElement?
The constructor defined directly in this class or augmentation that has the given name.
inherited
getSetter(String name) PropertyAccessorElement?
The setter (synthetic or explicit) defined directly in this class or augmentation that has the given name.
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