_common library

Classes

AdjacentStrings
Two or more string literals that are implicitly concatenated because of being adjacent (separated only by whitespace).
AnnotatedNode
An AST node that can be annotated with either a documentation comment, a list of annotations (metadata), or both.
Annotation
An annotation that can be associated with a declaration.
ArgumentList
A list of arguments in the invocation of an executable element (that is, a function, method, or constructor).
AsExpression
An as expression.
AssertInitializer
An assert in the initializer list of a constructor.
Assertion
An assertion, either in a block or in the initializer list of a constructor.
AssertStatement
An assert statement.
AssignedVariablePattern
A variable pattern in PatternAssignment.
AssignmentExpression
An assignment expression.
Assist
A base class for assists.
AstNode
A node in the AST structure for a Dart program.
AstVisitor<R>
An object that can be used to visit an AST structure.
AugmentedClassElement
The result of applying augmentations to a ClassElement.
AugmentedEnumElement
The result of applying augmentations to an EnumElement.
AugmentedExpression
The augmented expression.
AugmentedExtensionElement
The result of applying augmentations to an ExtensionElement.
AugmentedExtensionTypeElement
The result of applying augmentations to an ExtensionTypeElement.
AugmentedInstanceElement
The result of applying augmentations to a InstanceElement.
AugmentedInterfaceElement
The result of applying augmentations to a InterfaceElement.
AugmentedInvocation
Invocation of the augmented function, constructor, or method.
AugmentedMixinElement
The result of applying augmentations to a MixinElement.
AwaitAllFuturesRule
AwaitExpression
An await expression.
BinaryExpression
A binary (infix) expression.
BindPatternVariableElement
A pattern variable that is explicitly declared.
Block
A sequence of statements.
BlockFunctionBody
A function body that consists of a block of statements.
BooleanLiteral
A boolean literal expression.
BreakStatement
A break statement.
CascadeExpression
A sequence of cascaded expressions: expressions that share a common target.
CaseClause
The case clause that can optionally appear in an if statement.
CastPattern
A cast pattern.
CatchClause
A catch clause within a try statement.
CatchClauseParameter
An 'exception' or 'stackTrace' parameter in CatchClause.
ChangeBuilder
A class for modifying
ChangeReporter
A class used for requesting a ChangeBuilder.
ClassDeclaration
The declaration of a class.
ClassElement
An element that represents a class or a mixin. The class can be defined by either a class declaration (with a class body), a mixin application (without a class body), a mixin declaration, or an enum declaration.
ClassMember
A node that declares a name within the scope of a class, enum, extension, extension type, or mixin declaration.
ClassMemberElement
An element that is contained within a ClassElement.
ClassTypeAlias
A class type alias.
CollectionElement
Combinator
A combinator associated with an import or export directive.
Comment
A comment within the source code.
CommentReferableExpression
An interface for an Expression which can make up a CommentReference.
CommentReference
A reference to a Dart element that is found within a documentation comment.
CompilationUnit
A compilation unit.
CompilationUnitElement
An element representing a compilation unit.
CompilationUnitMember
A node that declares one or more names within the scope of a compilation unit.
CompoundAssignmentExpression
A potentially compound assignment.
ConditionalExpression
A conditional expression.
Configuration
A configuration in either an import or export directive.
ConstantPattern
A constant expression being used as a pattern.
ConstructorDeclaration
A constructor declaration.
ConstructorElement
An element representing a constructor or a factory method defined within a class.
ConstructorFieldInitializer
The initialization of a field within a constructor's initialization list.
ConstructorInitializer
A node that can occur in the initializer list of a constructor declaration.
ConstructorName
The name of a constructor.
ConstructorReference
An expression representing a reference to a constructor.
ConstructorReferenceNode
An AST node that makes reference to a constructor.
ConstructorSelector
The name of a constructor being invoked.
ContinueStatement
A continue statement.
CustomLintConfigs
Configurations representing the custom_lint metadata in the project's analysis_options.yaml.
CustomLintContext
An object for state shared between multiple LintRule/Assist/Fix...
CustomLintResolver
A class used to interact with files and possibly emit lints of out it.
DartAssist
A base class for creating assists inside Dart files.
DartFix
A base class for defining quick-fixes inside Dart files.
DartLintRule
A base class for emitting warnings/errors/infos inside Dart files.
DartPattern
A pattern.
DartType
The type associated with elements in the element model.
Declaration
A node that represents the declaration of one or more names.
DeclaredIdentifier
The declaration of a single identifier.
DeclaredVariablePattern
A variable pattern that declares a variable.
DefaultFormalParameter
A formal parameter with a default value.
DeferredImportElementPrefix
ImportElementPrefix that is used together with deferred.
Directive
A node that represents a directive.
DirectiveUri
Meaning of a URI referenced in a directive.
DirectiveUriWithLibrary
DirectiveUriWithSource that references a LibraryElement2.
DirectiveUriWithRelativeUri
DirectiveUriWithRelativeUriString that can be parsed into a relative URI.
DirectiveUriWithRelativeUriString
DirectiveUri for which we can get its relative URI string.
DirectiveUriWithSource
DirectiveUriWithRelativeUri that resolves to a Source.
DirectiveUriWithUnit
DirectiveUriWithSource that references a LibraryFragment.
DoStatement
A do statement.
DotShorthandInvocation
A node that represents a dot shorthand static method or constructor invocation.
DotShorthandPropertyAccess
A node that represents a dot shorthand property access of a field or a static getter.
DottedName
A dotted name, used in a configuration within an import or export directive.
DoubleLiteral
A floating point literal expression.
DynamicType
The type dynamic is a type which is a supertype of all other types, just like Object, with the difference that the static analysis assumes that every member access has a corresponding member with a signature that admits the given access.
Element
The base class for all of the elements in the element model. Generally speaking, the element model is a semantic model of the program that represents things that are declared with a name and hence can be referenced elsewhere in the code.
ElementAnnotation
A single annotation associated with an element.
ElementKind
The kind of elements in the element model.
ElementLocation
The location of an element within the element model.
ElementVisitor<R>
An object that can be used to visit an element structure.
EmptyFunctionBody
An empty function body.
EmptyStatement
An empty statement.
EnumConstantArguments
The arguments part of an enum constant.
EnumConstantDeclaration
The declaration of an enum constant.
EnumDeclaration
The declaration of an enumeration.
EnumElement
An element that represents an enum.
ErrorReporter
An object used to create analysis errors and report then to an error listener.
ErrorSeverity
The severity of an ErrorCode.
ExecutableElement
An element representing an executable object, including functions, methods, constructors, getters, and setters.
ExportDirective
An export directive.
Expression
A node that represents an expression.
ExpressionFunctionBody
A function body consisting of a single expression.
ExpressionStatement
An expression used as a statement.
ExtendsClause
The "extends" clause in a class declaration.
ExtensionDeclaration
The declaration of an extension of a type.
ExtensionElement
An element that represents an extension.
ExtensionOnClause
The on clause in an extension declaration.
ExtensionOverride
An override to force resolution to choose a member from a specific extension.
ExtensionTypeDeclaration
The declaration of an extension type.
ExtensionTypeElement
An element that represents an extension type.
FieldDeclaration
The declaration of one or more fields of the same type.
FieldElement
A field defined within a class.
FieldFormalParameter
A field formal parameter.
FieldFormalParameterElement
A field formal parameter defined within a constructor element.
Fix
A base class for plugins to define emit warnings/errors/infos.
ForEachParts
The parts of a for-each loop that control the iteration.
ForEachPartsWithDeclaration
The parts of a for-each loop that control the iteration when the loop variable is declared as part of the for loop.
ForEachPartsWithIdentifier
The parts of a for-each loop that control the iteration when the loop variable is declared outside of the for loop.
ForEachPartsWithPattern
A for-loop part with a pattern.
ForElement
The basic structure of a for element.
ForLoopParts
The parts of a for or for-each loop that control the iteration.
FormalParameter
A node representing a parameter to a function.
FormalParameterList
The formal parameter list of a method declaration, function declaration, or function type alias.
ForParts
The parts of a for loop that control the iteration.
ForPartsWithDeclarations
The parts of a for loop that control the iteration when there are one or more variable declarations as part of the for loop.
ForPartsWithExpression
The parts of a for loop that control the iteration when there are no variable declarations as part of the for loop.
ForPartsWithPattern
The parts of a for loop that control the iteration when there's a pattern declaration as part of the for loop.
ForStatement
A for or for-each statement.
FunctionBody
A node representing the body of a function or method.
FunctionDeclaration
A function declaration.
FunctionDeclarationStatement
A FunctionDeclaration used as a statement.
FunctionElement
A (non-method) function. This can be either a top-level function, a local function, a closure, or the initialization expression for a field or variable.
FunctionExpression
A function expression.
FunctionExpressionInvocation
The invocation of a function resulting from evaluating an expression.
FunctionReference
An expression representing a reference to a function, possibly with type arguments applied to it.
FunctionType
The type of a function, method, constructor, getter, or setter. Function types come in three variations:
FunctionTypeAlias
A function type alias.
FunctionTypedElement
An element that has a FunctionType as its type.
FunctionTypedFormalParameter
A function-typed formal parameter.
GenericFunctionType
An anonymous function type.
GenericFunctionTypeElement
The pseudo-declaration that defines a generic function type.
GenericTypeAlias
A generic type alias.
GuardedPattern
The pattern with an optional WhenClause.
HideCombinator
A combinator that restricts the names being imported to those that aren't in a given list.
HideElementCombinator
A combinator that causes some of the names in a namespace to be hidden when being imported.
Identifier
A node that represents an identifier.
IfElement
The basic structure of an if element.
IfStatement
An if statement.
ImplementsClause
The "implements" clause in an class declaration.
ImplicitCallReference
An expression representing an implicit 'call' method reference.
ImportDirective
An import directive.
ImportElementPrefix
Usage of a PrefixElement in an import directive.
ImportPrefixReference
Reference to an import prefix name.
IndexExpression
An index expression.
InstanceCreationExpression
An instance creation expression.
InstanceElement
An element that has this.
InstantiatedTypeAliasElement
Information about an instantiated TypeAliasElement2 and the type arguments with which it is instantiated.
IntegerLiteral
An integer literal expression.
InterfaceElement
An element that defines an InterfaceType.
InterfaceType
The type introduced by either a class or an interface, or a reference to such a type.
InterpolationElement
A node within a StringInterpolation.
InterpolationExpression
An expression embedded in a string interpolation.
InterpolationString
A non-empty substring of an interpolated string.
InvalidType
The type arising from code with errors, such as invalid type annotations, wrong number of type arguments, invocation of undefined methods, etc.
InvocationExpression
The invocation of a function or method.
IsExpression
An is expression.
JoinPatternVariableElement
A pattern variable that is a join of other pattern variables, created for a logical-or patterns, or shared case bodies in switch statements.
Label
A label on either a LabeledStatement or a NamedExpression.
LabeledStatement
A statement that has a label associated with them.
LabelElement
A label associated with a statement.
LibraryDirective
A library directive.
LibraryElement
A library.
LibraryExportElement
A single export directive within a library.
LibraryIdentifier
The identifier for a library.
LibraryImportElement
A single import directive within a library.
LibraryLanguageVersion
LintCode
A class representing an ErrorCode for LintRules.
LintOptions
Option information for a specific LintRule.
LintRule
A base class for plugins to define emit warnings/errors/infos.
LintRuleNodeRegistry
ListLiteral
A list literal.
ListPattern
A list pattern.
ListPatternElement
An element of a list pattern.
Literal
A node that represents a literal expression.
LocalElement
An element that can be (but is not required to be) defined within a method or function (an ExecutableElement).
LocalVariableElement
A local variable.
LogicalAndPattern
A logical-and pattern.
LogicalOrPattern
A logical-or pattern.
MapLiteralEntry
A single key/value pair in a map literal.
MapPattern
A map pattern.
MapPatternElement
An element of a map pattern.
MapPatternEntry
An entry in a map pattern.
MethodDeclaration
A method declaration.
MethodElement
An element that represents a method defined within a class.
MethodInvocation
The invocation of either a function or a method.
MethodReferenceExpression
An expression that implicitly makes reference to a method.
MixinDeclaration
The declaration of a mixin.
MixinElement
An element that represents a mixin.
MixinOnClause
The "on" clause in a mixin declaration.
MultiplyDefinedElement
A pseudo-element that represents multiple elements defined within a single scope that have the same name. This situation is not allowed by the language, so objects implementing this interface always represent an error. As a result, most of the normal operations on elements do not make sense and will return useless results.
MustBeAnonymousRule
MustBeStronglyRefRule
MustHandleReturnRule
MustUseMonadRule
MustUseUnsafeWrapperRule
NamedCompilationUnitMember
A node that declares a single name within the scope of a compilation unit.
NamedExpression
An expression that has a name associated with it.
NamedType
A named type, which can optionally include type arguments.
NamespaceCombinator
An object that controls how namespaces are combined.
NamespaceDirective
A node that represents a directive that impacts the namespace of a library.
NativeClause
The "native" clause in an class declaration.
NativeFunctionBody
A function body that consists of a native keyword followed by a string literal.
NeverType
The type Never represents the uninhabited bottom type.
NodeList<E extends AstNode>
A list of AST nodes that have a common parent.
NoFutureMonadTypeRule
NoFuturesRule
NormalFormalParameter
A formal parameter that is required (isn't optional).
NullAssertPattern
A null-assert pattern.
NullAwareElement
A null-aware element in a list or set literal.
NullCheckPattern
A null-check pattern.
NullLiteral
A null literal expression.
NullShortableExpression
Abstract interface for expressions that may participate in null-shorting.
ObjectPattern
An object pattern.
ParameterElement
A parameter defined within an executable element.
ParameterizedType
A type that can track substituted type parameters, either for itself after instantiation, or from a surrounding context.
ParenthesizedExpression
A parenthesized expression.
ParenthesizedPattern
A parenthesized pattern.
PartDirective
A part directive.
PartElement
A 'part' directive within a library.
PartOfDirective
A part-of directive.
PatternAssignment
A pattern assignment.
PatternField
A field in an object or record pattern.
PatternFieldName
A field name in an object or record pattern field.
PatternVariableDeclaration
A pattern variable declaration.
PatternVariableDeclarationStatement
A pattern variable declaration statement.
PatternVariableElement
A pattern variable.
PluginBase
A base class for custom analyzer plugins
PostfixExpression
A postfix unary expression.
PrefixedIdentifier
An identifier that is prefixed or an access to an object property where the target of the property access is a simple identifier.
PrefixElement
A prefix used to import one or more libraries into another library.
PrefixExpression
A prefix unary expression.
PromotableElement
A variable that might be subject to type promotion. This might be a local variable or a parameter.
PropertyAccess
The access of a property of an object.
PropertyAccessorElement
A getter or a setter. Note that explicitly defined property accessors implicitly define a synthetic field. Symmetrically, synthetic accessors are implicitly created for explicitly defined fields. The following rules apply:
PropertyInducingElement
A variable that has an associated getter and possibly a setter. Note that explicitly defined variables implicitly define a synthetic getter and that non-final explicitly defined variables implicitly define a synthetic setter. Symmetrically, synthetic fields are implicitly created for explicitly defined getters and setters. The following rules apply:
RecordLiteral
A record literal.
RecordPattern
A record pattern.
RecordType
The type of a record literal or a record type annotation.
RecordTypeAnnotation
A record type.
RecordTypeAnnotationField
A field in a RecordTypeAnnotation.
RecordTypeAnnotationNamedField
A named field in a RecordTypeAnnotation.
RecordTypeAnnotationNamedFields
The portion of a RecordTypeAnnotation with named fields.
RecordTypeAnnotationPositionalField
A positional field in a RecordTypeAnnotation.
RecordTypeField
A field in a RecordType.
RecordTypeNamedField
A named field in a RecordType.
RecordTypePositionalField
A positional field in a RecordType.
RecursiveAstVisitor<R>
An AST visitor that will recursively visit all of the nodes in an AST structure. For example, using an instance of this class to visit a Block will also cause all of the statements in the block to be visited.
RedirectingConstructorInvocation
The invocation of a constructor in the same class from within a constructor's initialization list.
RelationalPattern
A relational pattern.
RepresentationConstructorName
The name of the primary constructor of an extension type.
RepresentationDeclaration
The declaration of an extension type representation.
RestPatternElement
A rest pattern element.
RethrowExpression
A rethrow expression.
ReturnStatement
A return statement.
ScriptTag
A script tag that can optionally occur at the beginning of a compilation unit.
SetOrMapLiteral
A set or map literal.
ShowCombinator
A combinator that restricts the names being imported to those in a given list.
ShowElementCombinator
A combinator that cause some of the names in a namespace to be visible (and the rest hidden) when being imported.
SimpleFormalParameter
A simple formal parameter.
SimpleIdentifier
A simple identifier.
SimpleStringLiteral
A string literal expression that doesn't contain any interpolations.
SingleStringLiteral
A single string literal expression.
SpreadElement
A spread element.
Statement
A node that represents a statement.
StringInterpolation
A string interpolation literal.
StringLiteral
A string literal expression.
SuperConstructorInvocation
The invocation of a superclass' constructor from within a constructor's initialization list.
SuperExpression
A super expression.
SuperFormalParameter
A super-initializer formal parameter.
SuperFormalParameterElement
A super formal parameter defined within a constructor element.
SwitchCase
A case in a switch statement.
SwitchDefault
The default case in a switch statement.
SwitchExpression
A switch expression.
SwitchExpressionCase
A case in a switch expression.
SwitchMember
An element within a switch statement.
SwitchPatternCase
A pattern-based case in a switch statement.
SwitchStatement
A switch statement.
SymbolLiteral
A symbol literal expression.
ThisExpression
A this expression.
ThrowExpression
A throw expression.
TopLevelVariableDeclaration
The declaration of one or more top-level variables of the same type.
TopLevelVariableElement
A top-level variable.
TryStatement
A try statement.
TypeAlias
The declaration of a type alias.
TypeAliasElement
A type alias (typedef).
TypeAnnotation
A type annotation.
TypeArgumentList
A list of type arguments.
TypeChecker
An abstraction around doing static type checking at compile/build time.
TypeDefiningElement
An element that defines a type.
TypedLiteral
A literal that has a type associated with it.
TypeLiteral
An expression representing a type, such as the expression int in var x = int;.
TypeParameter
A type parameter.
TypeParameterElement
A type parameter.
TypeParameterizedElement
An element that has type parameters, such as a class or a typedef. This also includes functions and methods if support for generic methods is enabled.
TypeParameterList
Type parameters within a declaration.
TypeParameterType
The type introduced by a type parameter.
UndefinedElement
A pseudo-elements that represents names that are undefined. This situation is not allowed by the language, so objects implementing this interface always represent an error. As a result, most of the normal operations on elements do not make sense and will return useless results.
UriBasedDirective
A directive that references a URI.
UriReferencedElement
An element included into a library using some URI.
VariableDeclaration
An identifier that has an initial value associated with it.
VariableDeclarationList
The declaration of one or more variables of the same type.
VariableDeclarationStatement
A list of variables that are being declared in a context where a statement is required.
VariableElement
A variable. There are more specific subclasses for more specific kinds of variables.
VariablePattern
The shared interface of AssignedVariablePattern and DeclaredVariablePattern.
VoidType
The special type void is used to indicate that the value of an expression is meaningless, and intended to be discarded.
WhenClause
A guard in a pattern-based case in a switch statement, switch expression, if statement, or if element.
WhileStatement
A while statement.
WildcardPattern
A wildcard pattern.
WithClause
The with clause in a class declaration.
YieldStatement
A yield statement.

Extensions

AnalysisErrorSourceRange on AnalysisError
Adds sourceRange
PackageIOUtils on Directory
Utilities to help dealing with paths to common package files.
SyntacticEntitySourceRange on SyntacticEntity
Adds sourceRange

Functions

createPlugin() PluginBase
encodePrioritizedSourceChanges(Iterable<PrioritizedSourceChange> changes, {JsonEncoder? encoder, Map<String, String>? sources, String? relativePath}) String
Encodes a list of PrioritizedSourceChange into a string.
findProjectDirectory(Directory directory, {Directory? original}) Directory
Finds the project directory associated with an analysis context root
isDirectlyAnnotatedByText(AnnotatedNode node, String shortName, String longName) bool
isFutureOrFutureOr(DartType? type) bool
matcherNormalizedPrioritizedSourceChangeSnapshot(String filePath, {JsonEncoder? encoder, Map<String, String>? sources, String? relativePath}) → Matcher
Expects that a `List<PrioritizedSourceChange>` matches with a serialized snapshots.
parsePackageConfig(Directory directory) Future<PackageConfig>
Parse the package config of the given directory.
parsePubspec(Directory directory) Future<Pubspec>
Parse the pubspec of the given directory.
parsePubspecOverrides(Directory directory) Future<Map<String, Dependency>>
Parse the pubspec_overrides.yaml of the given directory.
parsePubspecSync(Directory directory) → Pubspec
Parse the pubspec of the given directory.
tryFindProjectDirectory(Directory directory, {Directory? original}) Directory?
Finds the project directory associated with an analysis context root, or null if it is not found
tryParsePackageConfig(Directory directory) Future<PackageConfig?>
Try parsing the package config of the given directory.
tryParsePubspec(Directory directory) Future<Pubspec?>
Try parsing the pubspec of the given directory.
tryParsePubspecOverrides(Directory directory) Future<Map<String, Dependency>?>
Try parsing the pubspec_overrides.yaml of the given directory.
tryParsePubspecSync(Directory directory) → Pubspec?
Try parsing the pubspec of the given directory.

Exceptions / Errors

UnresolvedAnnotationException
Exception thrown when TypeChecker fails to resolve a metadata annotation.