dependency_validator
5.1.0, released 2 months ago by workiva.com
Validates missing, under‑promoted, over‑promoted and unused dependencies in a Dart package.
What it does
The tool scans a package's source files and pubspec to find dependencies that are missing, declared only as dev_dependencies, over‑declared, or never used. It supports hook scripts, workspaces and configurable ignore/exclude rules.
AI-written summary of version 5.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to keep pubspec.yaml accurate and avoid bloated or broken dependencies
- Running CI checks for dependency hygiene in monorepos or single packages
- Before publishing a package to ensure all dependencies are correctly declared
Skip it when
- You need runtime dependency management inside the app
- You prefer IDE‑integrated linting over a separate CLI tool
Strengths
- Detects multiple dependency issues in one run
- Supports Pub Workspaces and hook directories
- Configurable ignore and exclude patterns
Weaknesses
- CLI‑only, no IDE integration
- May miss dynamically loaded packages
- Limited to Dart packages, not a Flutter widget library
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 13
Run `dart pub global activate dependency_validator` and then `dart pub global run dependency_validator`
dart pub global activate dependency_validator
dart pub global run dependency_validatorWorks with
Packages commonly used together with dependency_validator: ones it builds on, ones built on it, and its own family.
- analyzerdependency_validator depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamldependency_validator depends on itA Dart library for parsing YAML documents into Dart data structures.
- pub_semverdependency_validator depends on itVersions and version constraints implementing pub's versioning policy.
- globdependency_validator depends on itA file and directory globbing library that supports Bash-style path matching and listing.
- package_configdependency_validator depends on itRead and write Dart package configuration files.
- iodependency_validator depends on itUtilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
- pubspec_parsedependency_validator depends on itParse pubspec.yaml files with a type‑safe API and detailed error reporting.
- json_annotationdependency_validator depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.