SourceElement class

A class that represents a Dart element in a source file.

The element is one of the types in SourceElementType.

Constructors

SourceElement(SourceElementType type, String name, int startPos, {required File file, String className = '', List<SourceLine>? comment, int startLine = -1, List<CodeSample>? samples, bool override = false})
A factory constructor for SourceElements.
factory

Properties

applicationSampleCount int
The number of ApplicationSamples in the dartdoc comment for this element.
no setter
charCount int
Count of comment characters, not including any code samples in the comment, after collapsing each run of whitespace to a single space.
no setter
className String
The name of the class the element belongs to, if any.
final
comment List<SourceLine>
The list of SourceLines that make up the documentation comment for this SourceElement.
final
commentLines Iterable<String>
Get the comments as an iterable of lines.
no setter
commentString String
Get the comments as a single string.
no setter
commentStringWithoutCode String
Includes the description text inside of an "@tool"-based sample, but not the code itself, or any dartdoc tags.
no setter
commentStringWithoutTools String
Does not include the description of the sample code, just the text outside of any dartdoc tools.
no setter
dartpadSampleCount int
The number of DartpadSamples in the dartdoc comment for this element.
no setter
elementName String
Returns the fully qualified name of this element.
no setter
file → File
The file that this SourceElement was parsed from.
final
hashCode int
The hash code for this object.
no setterinherited
hasSeeAlso bool
Whether or not this element's documentation has a "See also:" section in it.
no setter
lineCount int
Count of comment lines, not including lines of code in the comment.
no setter
linkCount int
no setter
name String
The name of the element.
final
override bool
Whether or not this element has the "@override" annotation attached to it.
final
referenceCount int
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleCount int
The number of samples in the dartdoc comment for this element.
no setter
samples List<CodeSample>
The list of CodeSamples that are in the documentation comment for this SourceElement.
final
snippetCount int
The number of SnippetSamples in the dartdoc comment for this element.
no setter
startLine int
The line in the file that the first position of SourceElement is on.
final
startPos int
The character position in the file that this SourceElement starts at.
final
type SourceElementType
The type of the element
final
typeAsString String
Returns the type of this element as a String.
no setter
wordCount int
Count of comment words, not including words in any code in the comment.
no setter

Methods

copyWith({SourceElementType? type, String? name, int? startPos, File? file, String? className, List<SourceLine>? comment, int? startLine, List<CodeSample>? samples, bool? override}) SourceElement
Copy the source element, with some attributes optionally replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replaceSamples(Iterable<CodeSample> samples) → void
toString() String
A string representation of this object.
inherited

Operators

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