ClassElement class abstract

A class.

The class can be defined by either a class declaration (with a class body), or a mixin application (without a class body).

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

Implemented types

Constructors

ClassElement.new()

Properties

allSupertypes List<InterfaceType>
All the supertypes defined for this element and its supertypes.
no setterinherited
baseElement InstanceElement
The non-SubstitutedElementImpl version of this element.
no setterinherited
children List<Element>
The children of this element.
no setterinherited
children2 List<Element>
The children of this element.
no setterinherited
constructors List<ConstructorElement>
The constructors defined for this element.
no setterinherited
constructors2 List<ConstructorElement>
The constructors defined for this element.
no setterinherited
displayName String
The display name of this element, or an 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.
no setterinherited
enclosingElement LibraryElement
The element that either physically or logically encloses this element.
no setterinherited
enclosingElement2 LibraryElement
The element that either physically or logically encloses this element.
no setterinherited
fields List<FieldElement>
The fields declared in this element.
no setterinherited
fields2 List<FieldElement>
The fields declared in this element.
no setterinherited
firstFragment ClassFragment
The first fragment in the chain of fragments that are merged to make this element.
no setteroverride
fragments List<ClassFragment>
The fragments this element consists of.
no setteroverride
getters List<GetterElement>
The getters declared in this element.
no setterinherited
getters2 List<GetterElement>
The getters declared in this element.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasNonFinalField bool
Whether the class or its superclass declares a non-final instance field.
no setter
id int
The unique integer identifier of this element.
no setterinherited
inheritedConcreteMembers Map<Name, ExecutableElement>
Returns a map of all concrete members that this type inherits from superclasses and mixins, keyed by the member's Name.
no setterinherited
inheritedMembers Map<Name, ExecutableElement>
Returns a map of all members that this type inherits from supertypes via extends, with, implements, or on clauses, keyed by the member's Name.
no setterinherited
interfaceMembers Map<Name, ExecutableElement>
Returns a map of all members in the type's interface, keyed by the member's Name.
no setterinherited
interfaces List<InterfaceType>
The interfaces that are implemented by this class.
no setterinherited
isAbstract bool
Whether the class is abstract.
no setter
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 is exhaustive.
no setter
isExtendableOutside bool
Whether this class can be extended outside of its library.
no setter
isFinal bool
Whether the class is a final class.
no setter
isImplementableOutside bool
Whether the class can be implemented outside of its library.
no setter
isInterface bool
Whether the class is an interface class.
no setter
isMixableOutside bool
Whether the class can be mixed-in outside of its library.
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 this element is private.
no setterinherited
isPublic bool
Whether this 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 arguments as the bounds of a type parameter declaration.
no setterinherited
isSynthetic bool
Whether this 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 this element.
no setterinherited
library LibraryElement
Library that contains this element.
no setterinherited
library2 LibraryElement
Library that contains this element.
no setterinherited
lookupName String?
The name to use for lookup in maps.
no setterinherited
metadata Metadata
The metadata associated with the element.
no setterinherited
metadata2 Metadata
The metadata associated with the element or fragment.
no setterinherited
methods List<MethodElement>
The methods declared in this element.
no setterinherited
methods2 List<MethodElement>
The methods declared in this element.
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.
no setterinherited
name3 String?
The name of this element.
no setterinherited
nonSynthetic Element
The non-synthetic element that caused this element to be created.
no setterinherited
nonSynthetic2 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
setters List<SetterElement>
The setters declared in this element.
no setterinherited
setters2 List<SetterElement>
The setters declared in this element.
no setterinherited
sinceSdkVersion → Version?
The version where the associated SDK API was added.
no setterinherited
supertype InterfaceType?
The superclass of this element.
no setterinherited
thisType InterfaceType
The type of a this expression.
no setterinherited
typeParameters List<TypeParameterElement>
The type parameters declared by this element directly.
no setterinherited
typeParameters2 List<TypeParameterElement>
The type parameters declared by this element directly.
no setterinherited
unnamedConstructor ConstructorElement?
The unnamed constructor declared directly in this class.
no setterinherited
unnamedConstructor2 ConstructorElement?
The unnamed constructor declared directly in this class.
no setterinherited

Methods

accept<T>(ElementVisitor2<T> visitor) → T?
Uses the given visitor to visit this element.
inherited
accept2<T>(ElementVisitor2<T> visitor) → T?
Uses the given visitor to visit this element.
inherited
displayString({bool multiline = false, bool preferTypeAlias = false}) String
The presentation of this element as it should appear when presented to users.
inherited
displayString2({bool multiline = false, bool preferTypeAlias = false}) String
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
getExtendedDisplayName2({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?
Returns the field from fields that has the given name.
inherited
getField2(String name) FieldElement?
Returns the field from fields that has the given name.
inherited
getGetter(String name) GetterElement?
Returns the getter from getters that has the given name.
inherited
getGetter2(String name) GetterElement?
Returns the getter from getters that has the given name.
inherited
getInheritedConcreteMember(Name name) ExecutableElement?
Returns the most specific member with the given name that this type inherits from a superclass or mixin.
inherited
getInheritedMember(Name name) ExecutableElement?
Returns the most specific member with the given name that this type inherits from a supertype via an extends, with, implements, or on clause.
inherited
getInterfaceMember(Name name) ExecutableElement?
Returns the most specific member with the given name in this type's interface.
inherited
getMethod(String name) MethodElement?
Returns the method from methods that has the given name.
inherited
getMethod2(String name) MethodElement?
Returns the method from methods that has the given name.
inherited
getNamedConstructor(String name) ConstructorElement?
Returns the constructor from constructors that has the given name.
inherited
getNamedConstructor2(String name) ConstructorElement?
Returns the constructor from constructors that has the given name.
inherited
getOverridden(Name name) List<ExecutableElement>?
Returns all members of mixins, superclasses, and interfaces that a member with the given name, defined in this element, would override; or null if no members would be overridden.
inherited
getSetter(String name) SetterElement?
Returns the setter from setters that has the given name.
inherited
getSetter2(String name) SetterElement?
Returns the setter from setters 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
isAccessibleIn2(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, can be extended in the given library.
isExtendableIn2(LibraryElement library) bool
Whether the class, assuming that it is within scope, can be extended in the given library.
isImplementableIn(LibraryElement library) bool
Whether the class, assuming that it is within scope, can be implemented in the given library.
isImplementableIn2(LibraryElement library) bool
Whether the class, assuming that it is within scope, can be implemented in the given library.
isMixableIn(LibraryElement library) bool
Whether the class, assuming that it is within scope, can be mixed-in in the given library.
isMixableIn2(LibraryElement library) bool
Whether the class, assuming that it is within scope, can be mixed-in 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({required String name, required LibraryElement library}) GetterElement?
Returns the element representing the getter that results from looking up the given name in this class with respect to the given library, or null if the look up fails.
inherited
lookUpGetter2({required String name, required LibraryElement library}) GetterElement?
Returns the element representing the getter that results from looking up the given name in this class with respect to the given library, or null if the look up fails.
inherited
lookUpInheritedMethod({required String methodName, required 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
lookUpInheritedMethod2({required String methodName, required 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({required String name, required LibraryElement library}) MethodElement?
Returns the element representing the method that results from looking up the given name in this class with respect to the given library, or null if the look up fails.
inherited
lookUpMethod2({required String name, required LibraryElement library}) MethodElement?
Returns the element representing the method that results from looking up the given name in this class with respect to the given library, or null if the look up fails.
inherited
lookUpSetter({required String name, required LibraryElement library}) SetterElement?
Returns the element representing the setter that results from looking up the given name in this class with respect to the given library, or null if the look up fails.
inherited
lookUpSetter2({required String name, required LibraryElement library}) SetterElement?
Returns the element representing the setter that results from looking up the given name 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(bool predicate(Element)) Element?
Returns either this element or the most immediate ancestor of this element for which the predicate returns true.
inherited
thisOrAncestorMatching2(bool predicate(Element)) Element?
Returns either this element or the most immediate ancestor of this element for which the predicate returns true.
inherited
thisOrAncestorOfType<E extends Element>() → E?
Returns either this element or the most immediate ancestor of this element that has the given type.
inherited
thisOrAncestorOfType2<E extends Element>() → E?
Returns either this element or the most immediate ancestor of this element that has the given type.
inherited
toString() String
A string representation of this object.
inherited
visitChildren<T>(ElementVisitor2<T> 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
visitChildren2<T>(ElementVisitor2<T> 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