NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #1 most downloaded on pub.dev
This package provides a library that performs static analysis of Dart code.
Last release 15 days ago
11 Sep 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 57 of the last 60 stable releases
3 versions withdrawn
withdrawn after publishing
13 years old
389 releases · first in 2013
Nothing published for this version
The non_nullable feature is released in 2.12 language version.
Deprecated GenericTypeAliasElement. Use FunctionTypeAliasElement.
GenericTypeAliasElement. Use FunctionTypeAliasElement.AnalysisDriver.
Specifically, parseFileSync will not read any referenced files.One column per quarter.
Deprecated IndexExpression.auxiliaryElements and SimpleIdentifier.auxiliaryElements. Use CompoundAssignmentExpression.
IndexExpression.auxiliaryElements and
SimpleIdentifier.auxiliaryElements. Use CompoundAssignmentExpression.getReadType, use CompoundAssignmentExpression.Updated the current language version to 2.11.
2.11.* Require meta: ^1.2.3.
meta: ^1.2.3.Deprecated ElementAnnotation.constantValue, it does not guarantee that the value has been computed. Use computeConstantValue() instead.
LocalVariableElement.hasInitializer,
PropertyInducingElement.hasInitializer, ParameterElement.hasDefaultValue.ElementImpl.toString() uses getDisplayString(withNullability: true).ElementAnnotation.constantValue, it does not guarantee that
the value has been computed. Use computeConstantValue() instead.CompoundAssignmentExpression with read/write element/type getters.
This interface is implemented by AssignmentExpression, PostfixExpression
and PrefixExpression. Use it instead of staticElement and staticType
of the left-hand side expressions (target expressions in case of postfix
or prefix expressions with increment operator).Removed deprecated EmbedderSdk and related classes.
LibraryElement.featureSet.EmbedderSdk and related classes.FunctionType returned from ExecutableElement.type return null
as its element. Use ExecutableElements directly if necessary.FunctionTypeAliasElement does not implement FunctionTypedElement
anymore, implements TypeParameterizedElement instead.CustomUriResolver.ExplicitSourceResolver, FileUriResolver,
LocalSourcePredicate, PackageUriResolver, RelativeFileUriResolver.ErrorCode instances.withNullability flag in DartType.getDisplayString() is now required.DartType.substitute2, and FunctionType.substitute3,
use ClassElement.instantiate, FunctionTypeAliasElement.instantiate(),
or FunctionType.instantiate().FunctionType.boundTypeParameters, use typeFormals
for now. Later, it will be deprecated, and replaced with typeParameters.InterfaceType.instantiate(), InterfaceType.substitute4,
use ClassElement.instantiate().typeParameters and instantiate() from ParameterizedType.
Use typeParameters and instantiate() from ClassElement.DeclaredVariables.typeProvider and typeSystem getters.
Use corresponding LibraryElement getters instead.AnalysisOptions.ClassElement.hasReferenceToSuper.DartType.isObject.
Use DartType.isDartCoreObject instead.AnalysisContext and ContextLocator.ParseResult and ResolveResult.AnalysisContext.typeProvider and typeSystem.
Use the corresponding getters of LibraryElement.AnalysisSession.dart/ast/ast.dart.AstFactory.parseFile2..TypeDefiningElement.type.Feature are not constants anymore.Feature.firstSupportedVersion with releaseVersion.* Depend on cli_util 0.2.0.
Added TypeVisitorWithArgument and DartType.acceptWithArgument.
TypeVisitorWithArgument and DartType.acceptWithArgument.>=2.7.0, so that extension methods
can be used within the analyzer implementation. Previously it was 2.6.0,
but there is an issue.Move asInstanceOf(ClassElement) to DartType, so that it is also supported for TypeParameterType when its bound implements the requested interface.
asInstanceOf(ClassElement) to DartType, so that it is also
supported for TypeParameterType when its bound implements the
requested interface.InterfaceType.allSupertypes.currentVersion of the language updated to 2.10.Deprecated Scope.lookup(), use Scope.lookup2() instead.
defaultSdkDirectory() and getSdkProperty() from internal
FolderBasedDartSdk. It is up to the clients to decide how to
find SDK, for example using package:cli_util.LintDriver for the new way to access WorkspacePackage.Scope.lookup(), use Scope.lookup2() instead.ContextBuilder.createContext() and
ContextLocator.locateContexts to use the current SDK if sdkPath
is not provided.Removed deprecated internal bogus-disabled and bogus-enabled.
buildSdkSummary.DynamicType, NeverType, and VoidType interfaces.TypeVisitor and DartType.accept(TypeVisitor).ConstructorElement.returnType to InterfaceType.InterfaceType.allSupertypes.InterfaceType.asInstanceOf(ClassElement).bogus-disabled and bogus-enabled.Scope, LibraryElement.scope, and PrefixElement.scope.Deprecated canUseSummaries in DartSdkManager constructor. Summaries are not supported this way for SDK.
canUseSummaries in DartSdkManager constructor.
Summaries are not supported this way for SDK.Deprecated ClassElement.hasReferenceToSuper. It was used internally, should not be part of API.
ClassElement.hasReferenceToSuper.
It was used internally, should not be part of API.LibraryElement.languageVersionMajor/minor.
Use LibraryElement.languageVersion to access more specific information.Restored the default constructor in internal SummaryBuilder, and the featureSet named parameter in build, for build_resolvers compatibility. See #4216
SummaryBuilder,
and the featureSet named parameter in build, for build_resolvers
compatibility. See #42163.Deprecated DartType.isObject, use DartType.isDartCoreObject for consistency with other similar getters.
DartType.isObject, use DartType.isDartCoreObject for
consistency with other similar getters.InstanceCreationExpression.staticElement, use
constructorName.staticElement instead, like for MethodInvocation.Deprecated VariableElement.constantValue, it does not guarantee that the value has been computed. Use computeConstantValue() instead.
VariableElement.constantValue, it does not guarantee that
the value has been computed. Use computeConstantValue() instead.AnalysisOptions:
analyzeFunctionBodiesPredicate, disableCacheFlushing,
enableLazyAssignmentOperators, generateImplicitErrors,
generateSdkErrors, patchPaths, preserveComments,
trackCacheDependencies, and resetToDefaults.Added new error codes: ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING and THROW_OF_INVALID_TYPE.
Added Window and DocumentFragment to analyzer's mock SDK. These are required for upcoming changes to the unsafe_html lint.
Deprecated ClassElement.instantiateToBounds() and FunctionTypeAliasElement.instantiateToBounds(). With the null-safety feature, type arguments derived…
ClassElement.instantiateToBounds() and
FunctionTypeAliasElement.instantiateToBounds(). With the null-safety
feature, type arguments derived from type parameter bounds cannot be used as
is, and might require erasing nullability, when the element is instantiated
from a legacy library. Use TypeSystem.instantiateToBounds2() instead.DeclaredVariables.getBool/getInt/getString() and
TypeProvider.nullObject. These methods are used internally for constants
computation, and should not be used by clients.AstFactory.indexExpressionForCascade(). Please use
indexExpressionForCascade2 instead.AstFactory.indexExpressionForTarget(). Please use
indexExpressionForTarget2 instead.ClassElement.isOrInheritsProxy and ClassElement.isProxy. The
@proxy annotation is deprecated in the language, and will be removed.List constructor under all
circumstances.??) and
if-null compound assignment expressions (??=).Deprecated DartType.name, use element or getDisplayString() instead.
DartType.name, use element or getDisplayString() instead.Deprecated ErrorReporter.source setter. One file - one reporter.
>=2.6.0, so that extension methods
can be used within the analyzer implementation.ErrorReporter.source setter. One file - one reporter.Element.getAncestor. Use thisOrAncestorMatching or
thisOrAncestorOfType instead.DartType.displayName. Use getDisplayString instead.InterfaceType: lookupGetter,
lookUpGetterInSuperclass, lookUpInheritedGetter,
lookUpInheritedGetterOrMethod, lookUpInheritedMethod,
lookUpInheritedSetter, lookUpMethod, lookUpMethodInSuperclass,
lookUpSetter, and lookUpSetterInSuperclass. Use lookUpGetter2(),
lookUpMethod2(), or lookUpSetter2() instead, with concrete or
inherited flags as necessary.ErrorReporter.reportTypeErrorForNode. Use reportErrorForNode
instead.Deprecated AnalysisSession.typeProvider and AnalysisSession.typeSystem. Please use the corresponding getters in LibraryElement instead.
AnalysisSession.typeProvider and AnalysisSession.typeSystem.
Please use the corresponding getters in LibraryElement instead.* Fixed bug #39702.
Deprecated DartType.substitute2(). Use ClassElement.instantiate() or FunctionTypeAliasElement.instantiate() instead.
DartType.substitute2(). Use ClassElement.instantiate()
or FunctionTypeAliasElement.instantiate() instead.ParameterizedType.instantiate() and
InterfaceType.instantiate(). Use ClassElement.instantiate() instead.
Using FunctionType.instantiate() is still valid.FunctionTypeAliasElement.instantiate2, use instantiate2.
In the next version instantiate2 will be removed.ParameterizedType.typeParameters. Please use
ClassElement.typeParameters or FunctionType.typeFormals instead.…will be deprecated and removed in the next breaking change version.
DartType.isEquivalentTo.useDart2jsPaths argument in FolderBasedDartSdk constructor.
Dartium does not exist anymore, so there is just one dart:html.SourceFactory: context,
localSourcePredicate, clone, fromEncoding, isLocalSource.Element.computeNode.CompilationUnitElement.unit.Element.computeDocumentationComment.wrapped.dart with WrappedLibraryElement, etc.ResolutionMap resolutionMap. Use corresponding accessors
on AstNode(s) directly to get elements and types.DartType: flattenFutures,
isAssignableTo, isEquivalentTo, isMoreSpecificThan,
isSubtypeOf, isSupertypeOf, isDirectSupertypeOf.
Use corresponding methods of TypeSystem instead.isAlwaysThrows, isDeprecated, isFactory, isJS,
isOverride, isProtected, isRequired, isVisibleForTesting.
Use corresponding hasXyz getters.LibraryElement.libraryCycle.ElementHandle and ElementResynthesizer.ElementBuilder, DeclarationResolver, DirectiveResolver,
TypeParameterBoundsResolver, TypeResolverVisitor, etc.
Use ResolutionVisitor instead, it combines all these operations.FunctionTypeAliasElement.instantiate, use instantiate2 for now.
In the next version instantiate will be re-introduced with the same
signature and semantics as instantiate2, and instantiate2 will be
deprecated and removed in the next breaking change version.InheritanceManagerBase.ArgumentList.correspondingPropagatedParameters.
Use ArgumentList.correspondingStaticParameters instead.PrefixElement.importedLibraries. It was never
implemented.VariableElement.isPotentiallyMutatedInClosure and
VariableElement.isPotentiallyMutatedInScope. Please use the corresponding
methods in FunctionBody instead.Deprecated the boolean AnalysisDriver.useSummary2. Summary1 support has been removed, so clients should assume Summary2 is in use now.
PromotableElement, which representing
variables that can be type promoted (local variables and parameters,
but not fields).AnalysisDriver.useSummary2. Summary1 support has
been removed, so clients should assume Summary2 is in use now.useDart2jsPaths for SdkLibrariesReader.
We now always use Dart2js paths.Bug fixes: #33300, #38484, #38505.
Deprecated the following codes from StaticWarningCode. Please use the corresponding error codes from CompileTimeErrorCode instead:
StaticWarningCode. Please use the
corresponding error codes from CompileTimeErrorCode instead:
EXTRA_POSITIONAL_ARGUMENTSEXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMEDIMPORT_OF_NON_LIBRARYNOT_ENOUGH_REQUIRED_ARGUMENTSREDIRECT_TO_MISSING_CONSTRUCTORREDIRECT_TO_NON_CLASSUNDEFINED_CLASSUNDEFINED_NAMED_PARAMETERDeprecated HintCode.INVALID_REQUIRED_PARAM and replaced it with more specific hints, HintCode.INVALID_REQUIRED_NAMED_PARAM, HintCode.INVALID_REQUIRED_…
FunctionTypeAlias.declaredElement has been refined to
FunctionTypeAliasElement. Since the new type is a refinement of
the old one, the only effect on clients should be to make certain
casts unnecessary.HintCode.INVALID_REQUIRED_PARAM and replaced it with more
specific hints, HintCode.INVALID_REQUIRED_NAMED_PARAM,
HintCode.INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM, and
HintCode.INVALID_REQUIRED_POSITIONAL_PARAM to address #36966.CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS. It
has been renamed to
CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS.LinterVisitor support for extension method AST nodes.
The deprecated method AstFactory.compilationUnit2 has been removed. Clients should switch back to AstFactory.compilationUnit.
AstFactory.compilationUnit2 has been removed. Clients
should switch back to AstFactory.compilationUnit.ParsedLibraryResultImpl.tmp and the
deprecated method ResolvedLibraryResultImpl.tmp. Please use
AnalysisSession.getParsedLibraryByElement and
AnalysisSession.getResolvedLibraryByElement instead.MethodElement.getReifiedType.ClassMemberElement.enclosingElement was changed from
ClassElement to Element.Deprecated the isEquivalentTo(DartType) method of DartType. The operator == now correctly considers two types equal if and only if they represent the…
isDartCoreList, isDartCoreMap, isDartCoreNum,
isDartCoreSet, isDartCoreSymbol, and isDartCoreObject to DartType.DartObject.toFunctionValue.isEquivalentTo(DartType) method of DartType.
The operator == now correctly considers two types equal if and
only if they represent the same type as defined by the spec.isMoreSpecificThan(DartType) method of DartType.
Deprecated the isMoreSpecificThan(DartType) method of TypeSystem.
Deprecated the isSupertypeOf(DartType) method of TypeSystem.
Use TypeSystem.isSubtypeOf(DartType) instead.flattenFutures, isAssignableTo of DartType.
Use TypeSystem.flatten() and TypeSystem.isAssignableTo instead.path to parseString.TypeSystem.resolveToBound(DartType) implementation to do
what its documentation says.InterfaceType.isDirectSupertypeOf. There is no replacement; this
method was not intended to be used outside of the analyzer.Reverted an unintentional breaking API change (the return type of ClassMemberElement.enclosingElement was changed from ClassElement to Element). This
ClassMemberElement.enclosingElement was changed from ClassElement to
Element). This change will be postponed until 0.38.0.Removed deprecated getter DartType.isUndefined.
DartType.isUndefined.SdkLibrariesReader.InstanceCreationExpressionImpl.canBeConst.AstFactory.compilationUnit method now uses named parameters. Clients
that prepared for this change by switching to AstFactory.compilationUnit2
should now switch back to AstFactory.compilationUnit.AstNode.getAncestor. Please use AstNode.thisOrAncestorMatching or
AstNode.thisOrAncestorOfType.TypeSystem.isStrong, and its override
Dart2TypeSystem.isStrong.AnalysisError.isStaticOnly and the deprecated
setters AnalysisError.isStaticOnly and AnalysisError.offset.abstract setter in ClassElementImpl, EnumElementImpl,
MethodElementImpl, and PropertyAccessorElementImpl. isAbstract should
be used instead.AstVisitor.ForStatement2, ListLiteral.elements2,
SetOrMapLiteral.elements2, AstFactory.forStatement2, and
NodeLintRegistry.addForStatement2, as well as class ForStatement2. Use
the variants without the "2" suffix instead.parseFile to match parseFile2.
Clients that switched to using parseFile2 when parseFile was deprecated
should now switch back to parseFile.enableControlFlowCollections, enableNonNullable,
enableSpreadCollections, and enableTripleShift, and the method
configureFeatures. Made the featureSet parameter of the Parser
constructor a required parameter.Deprecated the isNonNullableUnit parameter of the TypeResolverVisitor constructor. TypeResolverVisitor should now be configured using the featureSet p…
isNonNullableUnit parameter of the TypeResolverVisitor
constructor. TypeResolverVisitor should now be configured using the
featureSet parameter.TypeParameter.declaredElement. It is
always guaranteed to return a TypeParameterElement.abstract setter in ClassElementImpl, EnumElementImpl,
MethodElementImpl, and PropertyAccessorElementImpl. isAbstract should
be used instead.(int) -> void to
void Function(int). This is more consistent with the syntax of Dart, and it
will avoid ambiguities when nullability is added to the type system. This
impacts to value returned by FunctionType.displayName and
FunctionType.toString and ExecutableElement.toString. Client code might be
broken if it depends on the content of the returned value.parseString to the public API. This can be used in
place of the deprecated functions parseCompilationUnit and
parseDirectives. Note that there is no option to parse only directives,
since this functionality is broken anyway (parseDirectives, despite its
name, parses the entire compilation unit).ClassTypeAlias.declaredElement to ClassElement.
There is no functional change; it has always returned an instance of
ClassElement.parseFile. Please use parseFile2 instead--in addition to
supporting the same featureSet and throwIfDiagnostics parameters as
parseString, it is much more efficient than parseFile.package:analyzer/analyzer.dart to
direct clients to suitable replacements.bogus-disabled and bogus-enabled. Clients
should not be relying on the presence of these flags.Deprecated AstFactory.compilationUnit. In a future analyzer release, this method will be changed so that all its parameters are named parameters. Clie…
AstFactory.compilationUnit. In a future analyzer release, this
method will be changed so that all its parameters are named parameters.
Clients wishing to prepare for this should switch to using
AstFactory.compilationUnit2.enableControlFlowCollections, enableNonNullable,
enableSpreadCollections, and enableTripleShift, as well as the
recently-introduced method configureFeatures. Parsers should now be
configured by passing a FeatureSet object to the Parser constructor.AnalysisError.isStaticOnly.AnalysisError.offset setter.LinterContext.canBeConstConstructor.* Bug fixes: #36724.
Deprecated DartType.isUndefined, and now it always returns false.
DartType.isUndefined, and now it always returns false.Deprecated ForStatement2 (use ForStatement instead)
Expression.precedence to Precedence. Clients
that prepared for this change by switching to Expression.precedence2 should
now return to using Expression.precedence.ForEachStatement (use ForStatement instead)MapLiteral and MapLiteral2 (use SetOrMapLiteral instead)SetLiteral and SetLiteral2 (use SetOrMapLiteral instead)ListLiteral2 (use ListLiteral instead)ForStatement2 (use ForStatement instead)visitForEachStatement (override visitForStatement instead)visitMapLiteral and visitMapLiteral2 (override visitSetOrMapLiteral
instead)visitSetLiteral and visitSetLiteral2 (override visitSetOrMapLiteral
instead)visitListLiteral2 (override visitListLiteral instead)visitForStatement2 visit method (use VisitForStatement
instead)mapLiteral and mapLiteral2 (use setOrMapLiteral instead)setLiteral and setLiteral2 (use setOrMapLiteral instead)listLiteral2 (use listLiteral instead)AstFactory.forStatement2, and introduced
AstFactory.forStatement to replace itListLiteral.elements to
NodeList<CollectionElement>ListLiteral.elements2 (use ListLiteral.elements instead)SetOrMapLiteral.elements2, and introduced
SetOrMapLiteral.elements to replace itNodeLintRegistry.addForStatement2 (use
NodeLintRegistry.addForStatement instead)Deprecated AST structures that will no longer be used after the control_flow_collections and spread_collections experiments are enabled. The following…
ForEachStatement (use ForStatement2 instead)ForStatement (use ForStatement2 instead)MapLiteral (use SetOrMapLiteral instead)SetLiteral (use SetOrMapLiteral instead)visitForEachStatement (override visitForStatement2 instead)visitForStatement (override visitForStatement2 instead)visitMapLiteral (override visitSetOrMapLiteral instead)visitSetLiteral (override visitSetOrMapLiteral instead)mapLiteral and mapLiteral2 (use setOrMapLiteral instead)setLiteral and setLiteral2 (use setOrMapLiteral instead)package:html (see #35802)The following AST node types will be deprecated soon:
ForEachStatement (use ForStatement2 instead)ForStatement (use ForStatement2 instead)MapLiteral (use SetOrMapLiteral instead)SetLiteral (use SetOrMapLiteral instead)Expression.precedence. In analyzer version 0.36.0, its return
type will be changed to Precedence. Clients that wish to prepare for the
change can switch to Expression.precedence2.Updated support in the AST structure for the control_flow_collections and spread_collections experiments. The following methods are now deprecated:
AstFactory.mapLiteral2 and AstFactory.setLiteral2 (replaced by
AstFactory.setOrMapLiteral).AstVisitor.visitListLiteral2 (clients should not need to override this
anymore).AstVisitor.visitMapLiteral2 and AstVisitor.visitSetLiteral2 (replaced by
AstVisitor.visitSetOrMapLiteral).The InheritanceManager class is now deprecated. The new InheritanceManager2 class now supports accessing inherited interface/class maps.
InheritanceManager class is now deprecated. The new
InheritanceManager2 class now supports accessing inherited interface/class
maps.Added support in the AST structure for the control_flow_collections and spread_collections experiments. This includes adding new visitor methods to As
AstVisitor, which will need to be implemented by any classes that implement
AstVisitor directly. Concrete implementations were added to other visitor
classes (such as RecursiveAstVisitor) so that clients that extend those
other classes will not be impacted.EMPTY_LIST constants. Please use const <...>[] instead.AnalysisSession
API.StrongTypeSystemImpl. Please use Dart2TypeSystem instead.Non-breaking AST changes in support for the control_flow_collections and spread_collections experiments. Clients who wish to begin adding support for
Split off DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE from DEPRECATED_MEMBER_USE (#30084).
@checked annotation. Please use the covariant
keyword instead (#28797).@literal:
NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR.Added a note to the UriResolver documentation alerting clients of an upcoming breaking change.
UriResolver documentation alerting clients of an
upcoming breaking change.Support for declarations-casts has been removed and the implicit-casts option now has the combined semantics of both options. This means that users th
declarations-casts has been removed and the implicit-casts
option now has the combined semantics of both options. This means that users
that disable implicit-casts might now see errors that were not previously
being reported.Deprecated AstNode.getAncestor and introduced AstNode.thisOrAncestorMatching as its replacement.
AstNode.getAncestor and introduced
AstNode.thisOrAncestorMatching as its replacement.Added a note to the UriResolver documentation alerting clients of an upcoming breaking change.
UriResolver documentation alerting clients of an
upcoming breaking change.Add AnalysisSession.getResolvedLibrary()/ByElement() APIs.
Add a new "deprecated" maturity for lints
Backport Parsed/ResolvedLibraryResultImpl and ElementDeclarationResult.
Fix missing import of dart:async.
Update SDK requirement to 2.1.0-dev.5.0. From now on, the analyzer may import Future from dart:core.
Protect against self-referencing classes in InheritanceManager2.
Begin replacing InheritanceManager with InheritanceManager2 and deprecate older members.
Support handling 'class C with M', with extends missing.
Your coding agent can read these notes before it upgrades. Set up the MCP server →