ReferenceCode class
A class that processes Dart source files to extract code references like classes, enums, mixins, and typedefs. It also prepares a cleaned version of the code (without comments or strings) for analysis.
Constructors
- ReferenceCode.new(File file)
-
Creates a ReferenceCode instance and processes the given
file
.
Properties
- cleanedCode ↔ String?
-
The fully cleaned code, ready for reference extraction.
getter/setter pair
- code ↔ String?
-
The original content of the file.
getter/setter pair
- codeWoComment ↔ String?
-
The file content with comments removed.
getter/setter pair
- codeWoString ↔ String?
-
The file content with string literals removed.
getter/setter pair
- dependenciesSize → int
-
Returns the number of dependencies found.
no setter
-
dependencyList
↔ List<
UsageList> -
The list of detected dependencies based on references.
getter/setter pair
- file ↔ File
-
The Dart source file to process.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
referenceList
↔ List<
String> -
The list of all references (class, enum, mixin, typedef names) extracted.
getter/setter pair
-
references
→ List<
String> -
Returns the list of extracted references.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
extractReference(
String stringCode) → List< String> -
Extracts references (classes, enums, mixins, typedefs) from the given
stringCode
. -
getRelativePath(
String basePath) → String -
Returns the relative path of this file from the given
basePath
. -
hasReference(
String value) → bool -
Checks if a given
value
is present in the cleaned code. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processCode(
) → void - Processes the file: reads content, cleans it, and extracts references.
-
processDependencies(
ReferenceCode baseReference, {bool used = true}) → void -
Processes dependencies by comparing references between
this
andbaseReference
. Ifused
is true,this
code usesbaseReference
, otherwise the inverse. -
removeComments(
String codeComments) → String -
Removes comments (both single-line and multi-line) from the given
codeComments
. -
removeStrings(
String code) → String -
Removes all string literals from the given
code
. -
replaceCharactersWithSpaces(
String text, String charactersToReplace) → String -
Replaces each character in
charactersToReplace
with a space in thetext
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited