ModelElement class

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
Implemented types
Mixed in types
Implementers

Constructors

ModelElement(Element _element, Library _library, PackageGraph _packageGraph, Member _originalMember)
ModelElement.from(Element e, Library library, PackageGraph packageGraph, {Container enclosingContainer})
Creates a ModelElement from a non-property-inducing e. [...]
factory
ModelElement.fromElement(Element e, PackageGraph p)
Creates a ModelElement from e.
factory
ModelElement.fromPropertyInducingElement(PropertyInducingElement e, Library library, PackageGraph packageGraph, {Container enclosingContainer, @required Accessor getter, @required Accessor setter})
Creates a ModelElement from PropertyInducingElement e. [...]
factory

Properties

allParameters List<Parameter>
read-only
annotations List<String>
read-only
canHaveParameters bool
read-only
canonicalLibrary Library
read-only, override
canonicalModelElement ModelElement
read-only
characterLocation CharacterLocation
read-only, override
commentRefs List<ModelCommentReference>
read-only, override
compilationUnitElement CompilationUnitElement
read-only
computeDocumentationFrom List<ModelElement>
Returns the ModelElement(s) from which we will get documentation. Can be more than one if this is a Field composing documentation from multiple Accessors. [...]
read-only
config DartdocOptionContext
read-only, override
definingLibrary Library
read-only
displayedCategories Iterable<Category>
read-only
displayedLanguageFeatures Iterable<LanguageFeature>
A list of language features that both apply to this ModelElement and make sense to display in context.
read-only, inherited
documentation String
Returns the docs, stripped of their leading comments syntax.
read-only, override
documentationAsHtml String
read-only, override
documentationComment String
read-only, inherited
documentationFrom List<ModelElement>
read-only, override
documentationIsLocal bool
True if documentationFrom contains only one item, this.
read-only, inherited
documentationLocal String
read-only
element Element
read-only
enclosingElement → Warnable
read-only, inherited
exportedInLibraries Set<Library>
read-only
Returns a link to extended documentation, or the empty string if that does not exist.
read-only
features Set<String>
read-only
featuresAsString String
read-only
fileName String
read-only
filePath String
read-only
fileType String
read-only
fullyQualifiedName String
Returns the fully qualified name. [...]
read-only, override
fullyQualifiedNameWithoutLibrary String
read-only, override
hasAnnotations bool
read-only
hasCategoryNames bool
read-only
hasDocumentation bool
read-only, override
hasExtendedDocumentation bool
read-only, override
hasFeatureSet bool
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
hasNodoc bool
Returns true if the raw documentation comment has a nodoc indication.
read-only, inherited
hasParameters bool
read-only
hasSourceCode bool
read-only, inherited
hasSourceHref bool
read-only
href String
If canonicalLibrary (or canonicalEnclosingElement, for Inheritable subclasses) is null, href should be null.
read-only, override
htmlId String
read-only
isAsynchronous bool
read-only
isCanonical bool
read-only, override
isConst bool
read-only
isDeprecated bool
read-only
isDocumented bool
read-only, override
isExecutable bool
read-only
isFinal bool
read-only
isLate bool
read-only
isLocalElement bool
read-only
isNullSafety bool
read-only, inherited
isPropertyAccessor bool
read-only
isPropertyInducer bool
read-only
isPublic bool
read-only, override
isPublicAndPackageDocumented bool
read-only
isStatic bool
read-only
kind String
A human-friendly name for the kind of element this is.
read-only, override
library Library
read-only, override
linkedName String
read-only
linkedParams String
read-only
linkedParamsLines String
read-only
linkedParamsNoMetadata String
read-only
linkedParamsNoMetadataOrNames String
read-only
location String
A string indicating the URI of this Locatable, usually derived from Element.location.
read-only, override
locationPieces Set<String>
Pieces of the location, split to remove 'package:' and slashes.
read-only, override
modelElementRenderer → ModelElementRenderer
@visibleForTesting, read-only, override
modelNode ModelNode
read-only, override
modelType ElementType
read-only
name String
read-only, override
namePart String
Utility getter/cache for _MarkdownCommentReference._getResultsForClass.
read-only, inherited
namePieces Set<String>
read-only, inherited
oneLineDoc String
read-only, override
originalMember → Member
read-only
overriddenDepth int
read-only, inherited
package Package
read-only
packageGraph PackageGraph
read-only, override
parameters List<Parameter>
read-only
pathContext Context
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sourceCode String
read-only, override
sourceFileName String
read-only, override
sourceHref String
read-only

Methods

annotationsFromMetadata(Iterable<ElementAnnotation> md) List<String>
Returns linked annotations from a given metadata set, with escaping.
buildCanonicalModelElement() ModelElement
buildDocumentationAddition(String docs) String
Override this to add more features to the documentation builder in a subclass.
compareTo(dynamic other) int
Compares this object to another Comparable [...]
override
computeDocumentationComment() String
Implement to derive the raw documentation comment string from the analyzer.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
precacheLocalDocs() Future<void>
Unconditionally precache local documentation. [...]
processComment(String documentationComment) Future<String>
Process documentationComment, performing various actions based on {@}-style directives, returning the processed result.
inherited
processCommentDirectives(String docs) String
inherited
processCommentWithoutTools(String documentationComment) String
Process a documentationComment, performing various actions based on {@}-style directives, except {@tool}, returning the processed result.
inherited
scoreCanonicalCandidates(Iterable<Library> libraries) List<ScoredCandidate>
inherited
scoreElementWithLibrary(Library lib) ScoredCandidate
@Deprecated('Public method intended to be private; will be removed as early as ' 'Dartdoc 1.0.0'), inherited
setModelType(ElementType type) → void
toString() String
Returns a string representation of this object.
override
warn(PackageWarning kind, {String message, Iterable<Locatable> referredFrom, Iterable<String> extendedDebug}) → void

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited