banned-dependencies
Warns when a pubspec contains a banned dependency.
note
This rule requires configuration in order to highlight any issues.
⚙️ Config
Set banned
(default is empty) to configure the list of banned packages.
Set banned-transitive
(default is empty) to configure the list of banned packages that are installed as a transitive dependency.
Set allowed
(default is empty) to configure the list of allowed packages.
analysis_options.yaml
dart_code_metrics:
pubspec-rules:
- banned-dependencies:
banned:
- get
- some_deprecated_package
Example
❌ Bad:
pubspec.yaml
name: some_package
description: ...
version: 1.0.0
dependencies:
some_deprecated_package: 1.0.0 # LINT: Package usage is prohibited.
✅ Good:
pubspec.yaml
name: some_package
description: ...
version: 1.0.0