Skip to main content

prefer-caret-version-syntax

added in: 1.2.0
Pro+

Warns when a dependency version is listed not with the caret syntax.

Although using exact dependency versions helps you control how and when you update your external dependencies, it's usually safe to update to minor and patch versions as soon as they are available.

Example

❌ Bad:

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

dependencies:
some_dependency: 1.0.0 # LINT: Specify the version range as ^version.

✅ Good:

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

dependencies:
some_dependency: ^1.0.0

Additional Resources