pubspeclisted
Install: claude install-skill virajp/ai-plugins
# pubspec & Dependency Management
`flutter pub get` and `pubspec.lock` own version resolution. Keep `pubspec.yaml`
declarative and uncluttered.
## Adding dependencies
- **Ask first.** Never add a new package (to `dependencies` or
`dev_dependencies`) without the user's explicit consent — name the package,
its pub.dev link, and what it's for, then wait for a yes.
- Add the package with **no version constraint** — `flutter pub get` resolves it
and `pubspec.lock` pins it.
- Add a `# https://pub.dev/packages/<name>` comment above every package.
- `dependencies:` for packages shipped in the app; `dev_dependencies:` for build
tools and test packages (`build_runner`, `mockito`, `import_sorter`,
`dependency_validator`, `flutter_lints`).
```yaml
dependencies:
# https://pub.dev/packages/get
get:
# https://pub.dev/packages/equatable
equatable:
dev_dependencies:
# https://pub.dev/packages/build_runner
build_runner:
```
After editing, sync and commit both files together:
```bash
flutter pub get
git add pubspec.yaml pubspec.lock # commit: "deps: add <package>"
```
## Rules
- Never edit `pubspec.lock` by hand — it is generated by `flutter pub get`.
- SDK constraints live under `environment:`; don't change them without testing
on both iOS and Android.
- Every imported package must be declared here — `dependency_validator` enforces
it (whitelist false positives in `dart_dependency_validator.yaml`).
- Check for updates with `flutter pub outdated`.
## Code-g