candies_analyzer_plugin
library
Functions
-
createLibraryNamePrefix({required String libraryPath, String? projectRoot, String? packageName})
→ String
-
Create a library name prefix based on
libraryPath, projectRoot and
current packageName.
-
getChildren(Element parent, [String? name])
→ List<Element>
-
Returns direct children of
parent.
-
getCompilationUnit(AstNode node)
→ CompilationUnit?
-
Return the compilation unit of a node
-
getFieldName(FieldDeclaration decl, String name)
→ Token?
-
Returns a field identifier with the given
name in the given decl's
variable declaration list or null if none is found.
-
getIntValue(Expression expression, LinterContext? context)
→ int?
-
Returns the value of an
IntegerLiteral or PrefixExpression with a
minus and then an IntegerLiteral. If a context is provided,
SimpleIdentifiers are evaluated as constants. For anything else,
returns null.
-
getNodeToAnnotate(Declaration node)
→ SyntacticEntity
-
Returns the most specific AST node appropriate for associating errors.
-
getWriteOrReadElement(SimpleIdentifier node)
→ Element?
-
If the
node is the finishing identifier of an assignment, return its
"writeElement", otherwise return its "staticElement", which might be
thought as the "readElement".
-
hasConstantError(LinterContext context, Expression node)
→ bool
-
-
hasLeadingUnderscore(String name)
→ bool
-
Returns
true if the given name has a leading _.
-
hasLiteralAnnotation(Element element)
→ bool
-
Returns
true if this element has a @literal annotation.
-
hasOverrideAnnotation(Element element)
→ bool
-
Returns
true if this element has an @override annotation.
-
inPrivateMember(AstNode node)
→ bool
-
Returns
true if this node is the child of a private compilation unit
member.
-
isCamelCase(String string)
→ bool
-
Check if this
string is formatted in CamelCase.
-
isDartFileName(String fileName)
→ bool
-
Returns
true if this fileName is a Dart file.
-
isEquals(ClassMember element)
→ bool
-
Returns
true if this element is the == method declaration.
-
isFinalOrConst(Token token)
→ bool
-
Returns
true if the keyword associated with this token is final or
const.
-
isHashCode(ClassMember element)
→ bool
-
Returns
true if this element is a hashCode method or field declaration.
-
isIdentifier(String name)
→ bool
-
Returns
true if this name is a legal Dart identifier.
-
isIndex(ClassMember element)
→ bool
-
Returns
true if this element is an index method or field declaration.
-
isInLibDir(CompilationUnit node, WorkspacePackage? package)
→ bool
-
Return true if this compilation unit
node is declared within the given
package's lib/ directory tree.
-
isInPublicDir(CompilationUnit node, WorkspacePackage? package)
→ bool
-
Return
true if this compilation unit node is declared within a public
directory in the given package's directory tree. Public dirs are the
lib and bin dirs.
-
isKeyword(Token token, Keyword keyword)
→ bool
-
Returns
true if the keyword associated with the given token matches
keyword.
-
isKeyWord(String id)
→ bool
-
Returns
true if the given id is a Dart keyword.
-
isLowerCamelCase(String id)
→ bool
-
Returns
true if this id is lowerCamelCase.
-
isLowerCaseUnderScore(String id)
→ bool
-
Returns
true if this id is lower_camel_case_with_underscores.
-
isLowerCaseUnderScoreWithDots(String id)
→ bool
-
Returns
true if this id is lower_camel_case_with_underscores_or.dots.
-
isMethod(ClassMember m)
→ bool
-
Returns
true if the given ClassMember is a method.
-
isPrivate(Token? name)
→ bool
-
Check if the given identifier has a private name.
-
isPublicMethod(ClassMember m)
→ bool
-
Returns
true if the given ClassMember is a public method.
-
isPubspecFileName(String fileName)
→ bool
-
Returns
true if this fileName is a Pubspec file.
-
isReservedWord(String word)
→ bool
-
Check if the given word is a Dart reserved word.
-
isSimpleGetter(MethodDeclaration declaration)
→ bool
-
Returns
true if the given method declaration is a "simple getter".
-
isSimpleSetter(MethodDeclaration setter)
→ bool
-
Returns
true if the given setter is a "simple setter".
-
isUpperCase(int c)
→ bool
-
Returns
true if the given code unit c is upper case.
-
isValidDartIdentifier(String id)
→ bool
-
Returns
true if the given id is a valid Dart identifier.
-
isValidLibraryPrefix(String libraryPrefix)
→ bool
-
Returns true if this
libraryPrefix is valid.
-
isValidPackageName(String id)
→ bool
-
Returns true if this
id is a valid package name.
-
isValues(ClassMember element)
→ bool
-
Returns
true if this element is a values method or field declaration.
-
isVar(Token token)
→ bool
-
Returns
true if the keyword associated with this token is var.
-
lintFiles(DartLinter linter, List<File> filesToLint)
→ Future<Iterable<AnalysisErrorInfo>>
-
-
loadYaml(String yaml, {Uri? sourceUrl, bool recover = false, ErrorListener? errorListener})
→ dynamic
-
Loads a single document from a YAML string.
-
loadYamlDocument(String yaml, {Uri? sourceUrl, bool recover = false, ErrorListener? errorListener})
→ YamlDocument
-
Loads a single document from a YAML string as a YamlDocument.
-
loadYamlDocuments(String yaml, {Uri? sourceUrl})
→ List<YamlDocument>
-
Loads a stream of documents from a YAML string.
-
loadYamlNode(String yaml, {Uri? sourceUrl, bool recover = false, ErrorListener? errorListener})
→ YamlNode
-
Loads a single document from a YAML string as a YamlNode.
-
loadYamlStream(String yaml, {Uri? sourceUrl})
→ YamlList
-
Loads a stream of documents from a YAML string.
-
locatePubspecFile(CompilationUnit compilationUnit)
→ File?
-
Return the nearest enclosing pubspec file.
-
visitChildren(Element element, ElementProcessor processor)
→ void
-
Uses
processor to visit all of the children of element.
If processor returns true, then children of a child are visited too.
Typedefs
-
ElementProcessor
= bool Function(Element element)
-
An
Element processor function type.
If true is returned, children of element will be visited.
-
YamlWarningCallback
= void Function(String message, [SourceSpan? span])
-
A callback for emitting a warning.
Exceptions / Errors
-
YamlException
-
An error thrown by the YAML processor.