ModelElement class abstract
This class is the foundation of Dartdoc's model for source code.
All ModelElements are contained within a PackageGraph, and laid out in a structure that mirrors the availability of identifiers in the various namespaces within that package. For example, multiple Class objects for a particular identifier (ModelElement.element) may show up in different Librarys as the identifier is reexported.
However, ModelElements have an additional concept vital to generating documentation: canonicalization.
A ModelElement is canonical if it is the element in the namespace where that element 'comes from' in the public interface to this PackageGraph. That often means the ModelElement.library is contained in PackageGraph.libraries, but there are many exceptions and ambiguities the code tries to address here.
Non-canonical elements should refer to their canonical counterparts, making it easy to calculate links via ModelElement.href without having to know in a particular namespace which elements are canonical or not. A number of PackageGraph methods, such as PackageGraph.findCanonicalModelElementFor can help with this.
When documenting, Dartdoc should only write out files corresponding to canonical instances of ModelElement (ModelElement.isCanonical). This helps prevent subtle bugs as generated output for a non-canonical ModelElement will reference itself as part of the "wrong" Library from the public interface perspective.
- Inheritance
-
- Object
- Canonicalization
- ModelElement
- Implemented types
- Mixed in types
- Implementers
Constructors
- ModelElement(Element _element, Library? _library, PackageGraph _packageGraph, [Member? _originalMember])
Properties
-
allParameters
→ List<
Parameter> -
latefinal
-
annotations
→ Iterable<
Annotation> -
latefinal
- canonicalLibrary → Library?
-
latefinal
- canonicalModelElement → ModelElement?
-
latefinal
- characterLocation → CharacterLocation?
-
latefinal
- compilationUnitElement → CompilationUnitElement?
-
no setter
- config → DartdocOptionContext
-
latefinal
- definingCommentReferable → CommentReferable
-
For testing / comparison only, get the comment referable from where this
ElementType was defined. Override where an
Element
is available.no setter - definingLibrary → Library
-
no setter
-
displayedCategories
→ Iterable<
Category?> -
no setter
-
displayedLanguageFeatures
→ Iterable<
LanguageFeature> -
A list of language features that both apply to this ModelElement and
make sense to display in context.
no setterinherited
- documentation → String
-
Returns the docs, stripped of their leading comments syntax.
no setteroverride
- documentationAsHtml → String?
-
latefinalinherited
- documentationComment → String
-
The rawest form of the documentation comment, including comment delimiters
like
///
,//
,/*
,*/
.no setteroverride -
documentationFrom
→ List<
DocumentationComment> -
The ModelElement from which we will get documentation.
no setterinherited
- documentationIsLocal → bool
-
True if documentationFrom contains only one item, this.
no setterinherited
- documentationLocal → String?
-
no setterinherited
- element → Element?
-
no setter
- elementDocumentation → Documentation
-
latefinalinherited
- enclosingElement → Warnable?
-
no setterinherited
-
exportedInLibraries
→ Set<
Library> ? -
no setter
-
features
→ Set<
Feature> -
Usually a superset of annotations except where
_specialFeatures
replace them, a list of annotations as well as tags applied by Dartdoc itself when it notices characteristics of an element that need to be documented. SeeFeature
for a list.no setter - featuresAsString → String
-
no setter
- fileName → String
-
no setter
- filePath → String?
-
no setter
- fileType → String
-
no setter
- fullyQualifiedName → String
-
Returns the fully qualified name.
latefinal
- fullyQualifiedNameWithoutLibrary → String
-
no setteroverride
- hasAnnotations → bool
-
no setter
- hasCategoryNames → bool
-
no setter
- hasDocumentation → bool
-
no setteroverride
- hasDocumentationComment → bool
-
True if this has a synthetic/inherited or local documentation
comment. False otherwise.
no setteroverride
- hasFeatures → bool
-
no setter
- hasFeatureSet → bool
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNodoc → bool
-
Returns true if the raw documentation comment has a 'nodoc' indication.
latefinalinherited
- hasParameters → bool
-
no setter
- hasSourceCode → bool
-
no setterinherited
- hasSourceHref → bool
-
no setter
- href → String?
-
If canonicalLibrary (or canonicalEnclosingElement, for Inheritable
subclasses) is null, href should be null.
no setteroverride
- htmlId → String
-
no setter
- isAsynchronous → bool
-
no setter
- isCallable → bool
-
no setter
- isCanonical → bool
-
no setteroverride
- isConst → bool
-
no setter
- isDeprecated → bool
-
no setter
- isDocumented → bool
-
no setteroverride
- isEnumValue → bool
-
Whether this element is an enum value.
no setter
- isExecutable → bool
-
no setter
- isFinal → bool
-
no setter
- isLate → bool
-
no setter
- isLocalElement → bool
-
no setter
- isNullSafety → bool
-
no setterinherited
- isPropertyAccessor → bool
-
no setter
- isPropertyInducer → bool
-
no setter
- isPublic → bool
-
latefinal
- isPublicAndPackageDocumented → bool
-
no setter
- isStatic → bool
-
no setter
- kind → String
-
A human-friendly name for the kind of element this is.
no setteroverride
- library → Library?
-
no setter
- linkedName → String
-
latefinal
- linkedObjectType → String
-
no setter
- linkedParams → String
-
no setter
- linkedParamsLines → String
-
no setter
- linkedParamsNoMetadata → String?
-
no setter
- linkedParamsNoMetadataOrNames → String
-
no setter
- location → String
-
A string indicating the URI of this Locatable, usually derived from
Element.location
.no setteroverride -
locationPieces
→ Set<
String> -
Pieces of the location, split to remove 'package:' and slashes.
latefinal
- modelBuilder → ModelObjectBuilder
-
Override implementations in unit tests to avoid requiring literal
ModelElements.
latefinalinherited
- modelElementRenderer → ModelElementRenderer
-
no setteroverride
- modelNode → ModelNode?
-
latefinal
- name → String
-
no setteroverride
- namePart → String
-
Utility getter/cache for
_MarkdownCommentReference._getResultsForClass
.latefinalinherited -
namePieces
→ Set<
String> -
latefinalinherited
- needsPrecache → bool
-
no setterinherited
- oneLineDoc → String?
-
no setteroverride
- originalMember → Member?
-
no setter
- overriddenDepth → int?
-
no setterinherited
- package → Package?
-
no setter
- packageGraph → PackageGraph
-
no setteroverride
-
parameters
→ List<
Parameter> -
latefinal
- pathContext → Context
-
no setteroverride
-
referenceChildren
→ Map<
String, CommentReferable> -
Map of referenceName to the elements that are a member of this, but
not this model element itself. Can be cached.
no setterinherited
-
referenceGrandparentOverrides
→ Iterable<
CommentReferable> ? -
Replace the parents of parents. referenceBy ignores whatever might
otherwise be implied by the referenceParents of referenceParents,
replacing them with this.
no setterinherited
- referenceName → String
-
no setterinherited
-
referenceParents
→ Iterable<
CommentReferable> -
Iterable of immediate "parents" to try resolving component parts.
referenceBy stops at the first parent where a part is found.
Can be cached.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → Scope?
-
For any
CommentReferable
where an analyzerScope
exists (or can be constructed), implement this. This will take priority over lookups via referenceChildren. Can be cached.no setterinherited - sourceCode → String
-
latefinal
- sourceFileName → String
-
no setteroverride
- sourceHref → String
-
latefinal
Methods
-
buildDocumentationAddition(
String docs) → String -
Override this to add more features to the documentation builder in a
subclass.
inherited
-
childLookups(
List< String> reference) → Iterable<ReferenceChildrenLookup> -
A list of lookups that should be attempted on children based on
reference
. This allows us to deal with libraries that may have separators in them. referenceBy stops at the first one found.inherited -
compareTo(
dynamic other) → int -
Compares this object to another object.
override
-
injectMacros(
String rawDocs) → String -
Replace {@macro ...} in API comments with the contents of the macro
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
precacheLocalDocs(
) → Future< void> -
Unconditionally precache local documentation.
inherited
-
processComment(
String documentationComment) → Future< String> -
Process
documentationComment
, performing various actions based on{@}
-style directives, returning the processed result.inherited -
processCommentDirectives(
String docs) → String -
inherited
-
referenceBy(
List< String> reference, {required bool filter(CommentReferable?), required bool allowTree(CommentReferable?), bool tryParents = true, Iterable<CommentReferable> ? parentOverrides}) → CommentReferable? -
Look up a comment reference by its component parts.
inherited
-
scoreCanonicalCandidates(
Iterable< Library> libraries) → List<ScoredCandidate> -
inherited
-
toString(
) → String -
A string representation of this object.
override
-
warn(
PackageWarning kind, {String? message, Iterable< Locatable> referredFrom = const [], Iterable<String> extendedDebug = const []}) → void -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited