Skip to main content

avoid-any-version

added in: 1.2.0
Pro+

Warns when a dependency version is set as any.

Not specifying a dependency version can lead to unexpected breaking changes when the dependency is updated. Prefer to specify a version range or an exact version of the external dependency.

Example

❌ Bad:

pubspec.yaml
name: some_package
description: ...
version: 1.0.0

dependencies:
some_dependency: any # LINT: Avoid specifying package version as 'any'.

✅ Good:

pubspec.yaml
name: some_package
description: ...
version: 1.0.0

dependencies:
some_dependency: ^1.0.0 # Correct, uses a version range instead

Additional Resources