Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

dart-resolve-package-conflicts — Claude Code skill: resolve Dart

Skill for resolving Dart package version conflicts when pub get fails. Teaches how to audit dependencies, update packages within constraints, and surgically remove entries from the lockfile.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dart-lang/skills --skill dart-resolve-package-conflicts -a claude-code
Open on GitHub

What dart-resolve-package-conflicts does

Dart enforces a single version of each package across a project and its transitive dependencies to prevent type mismatches, but this creates a risk of version lock. The skill embeds a workflow that shows how to audit dependencies using dart pub outdated, distinguish between upgradable and resolvable versions, and update packages without rewriting the entire lockfile.

The workflow covers three main scenarios: upgrading to versions allowed by current constraints in pubspec.yaml using dart pub upgrade, upgrading with constraint changes for major versions, and surgically removing a specific package entry from pubspec.lock without touching the rest. Each scenario includes verification steps via dart analyze and dart test.

Critical: never delete the entire pubspec.lock — it triggers uncontrolled upgrades across all dependencies. The skill teaches the correct approach: delete only the conflicting package's block, then run dart pub get to resolve that single package.

What it helps with

  • determine which packages can be updated within current constraints
  • upgrade a major dependency version without full dependency graph recalculation
  • surgically remove a conflicting or retracted package from the lockfile
  • verify that the dependency graph resolves correctly

Example prompts for the agent

  • Help me resolve a version conflict in my Dart project using dart-resolve-package-conflicts
  • Show me which packages can be updated using `dart pub upgrade --tighten`
  • How do I remove a package entry from `pubspec.lock` and re-resolve only that package?

How to install dart-resolve-package-conflicts

1Skills CLI (Vercel)

npx skills add dart-lang/skills --skill dart-resolve-package-conflicts -a claude-code

2Manually: put the files in place

~/.claude/skills/dart-resolve-package-conflicts/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/dart-resolve-package-conflicts/

From the same set7

The whole set →

Similar

laravel-best-practices laravel Indexes Laravel backend conventions for models, migrations, queues, and queries. It enforces existing codebase patterns before introducing new abstractions. Claude Code CX Codex Cursor +1 2,100installs wp-plugin-development WordPress This skill guides WordPress plugin work, from project structure and hooks to admin settings, security checks and release packaging. Claude Code CX Codex Cursor +1 7,900installs firecrawl-build-scrape firecrawl This skill guides integration of Firecrawl /scrape into product code for single-page extraction. It applies when an app has a known URL and needs markdown, HTML, or metadata. Claude Code CX Codex Cursor +1 61,600installs firecrawl-build-onboarding firecrawl Skill fetches Firecrawl credentials and sets up the SDK in your project via built-in browser authentication. Use when your app needs FIRECRAWL_API_KEY or you're adding Firecrawl to .env. Claude Code CX Codex Cursor +1 61,200installs onboard-context-matic official github Interactive tour of the context-matic MCP server. It detects project languages, catalogs supported APIs, and demonstrates live model and endpoint lookups. GitHub Copilot 1,000installs blockchain-developer sickn33 This skill guides smart contract, Web3 application, and decentralized-system work. Use it for design, reviews, and transaction checks before any on-chain action. Claude Code CX Codex Cursor +1 1,200installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. Claude Code Claude.ai 130,949installs google-agents-cli-adk-code official Google A reference skill for building ADK agents with tools, callbacks, state, and workflows. Use it when an agent project needs concrete API patterns or code examples. Claude Code CX Codex Cursor +1 511,400installs

Questions about dart-resolve-package-conflicts

How do I install dart-resolve-package-conflicts in Claude Code?

Run npx skills add dart-lang/skills --skill dart-resolve-package-conflicts -a claude-code, then edit ~/.claude/skills/dart-resolve-package-conflicts/SKILL.md.

What does dart-resolve-package-conflicts do?

It's a skill for resolving Dart package version conflicts. It teaches how to audit dependencies, update packages within constraints or modify constraints themselves, and surgically remove specific packages from the lockfile without rewriting the rest.

Why can't I just delete the entire `pubspec.lock`?

Deleting the whole lockfile triggers uncontrolled upgrades across all dependencies at once, risking incompatibilities. The skill teaches the correct way: delete only the conflicting package's entry, then run dart pub get to resolve that one package.

Source text

SKILL.md · BSD-3-Clause
---
name: dart-resolve-package-conflicts
description: Workflow for fixing package version conflicts. Use this when `pub get` fails due to incompatible package versions.
metadata:
  model: models/gemini-3.1-pro-preview
  last_modified: Fri, 24 Apr 2026 15:11:14 GMT
---
# Managing Dart Dependencies

## Contents
- [Core Concepts](#core-concepts)
- [Version Constraints](#version-constraints)
- [Workflow: Auditing Dependencies](#workflow-auditing-dependencies)
- [Workflow: Upgrading Dependencies](#workflow-upgrading-dependencies)
- [Workflow: Resolving Version Conflicts](#workflow-resolving-version-conflicts)
- [Examples](#examples)

## Core Concepts

Dart enforces a strict single-version rule for dependencies: a project and all its transitive dependencies must resolve to a single, shared version of any given package. This prevents runtime type mismatches but introduces the risk of "version lock."

To mitigate version lock, Dart relies on version constraints rather than pinned versions in the `pubspec.yaml`. The `pubspec.lock` file maintains the exact resolved versions for reproducible builds.

Understand the output columns of `dart pub outdated`:
*   **Current:** The version currently recorded in `pubspec.lock`.
*   **Upgradable:** The latest version allowed by the constraints in `pubspec.yaml`. `dart pub upgrade` resolves to this.
*   **Resolvable:** The absolute latest version that can be resolved when factoring in all other dependencies in the project.
*   **Latest:** The latest published version of the package (excluding prereleases).

## Version Constraints

*   **Use Caret Syntax:** Always use caret syntax (e.g., `^1.2.3`) for dependencies in `pubspec.yaml`. This allows `pub` to select newer, non-breaking versions (up to, but not including, the next major version) during resolution.
*   **Tighten Dev Dependencies:** Set the lower bound of `dev_dependencies` to the exact version currently used. This reduces resolution complexity and prevents older, incompatible dev tools from being selected.
*   **Enforce Lockfiles in CI:** Use `dart pub get --enforce-lockfile` in CI/CD pipelines to ensure the exact versions tested locally are used in production.

## Workflow: Auditing Dependencies

Run this workflow periodically to identify stale packages that may impact stability or performance.

**Task Progress:**
- [ ] Run `dart pub outdated`.
- [ ] Review the **Upgradable** column to identify packages that can be updated without modifying `pubspec.yaml`.
- [ ] Review the **Resolvable** column to identify packages that require constraint modifications in `pubspec.yaml` to update.
- [ ] Identify any packages marked as retracted or discontinued.

## Workflow: Upgrading Dependencies

Use conditional logic based on the audit results to upgrade dependencies.

**Task Progress:**
- [ ] **If updating to "Upgradable" versions:**
  - [ ] Run `dart pub upgrade`.
  - [ ] Run `dart pub upgrade --tighten` to automatically update the lower bounds in `pubspec.yaml` to match the newly resolved versions.
- [ ] **If updating to "Resolvable" versions (Major updates):**
  - [ ] Manually edit `pubspec.yaml` to bump the version constraint to match the "Resolvable" column (e.g., change `^0.11.0` to `^0.12.1`).
  - [ ] Run `dart pub upgrade` to resolve the new constraints and update `pubspec.lock`.
- [ ] **Feedback Loop:**
  - [ ] Run `dart analyze` -> review errors -> fix breaking API changes.
  - [ ] Run `dart test` -> review failures -> fix regressions.

## Workflow: Resolving Version Conflicts

When `pub` cannot find a set of concrete versions that satisfy all constraints, or when dealing with a retracted package version, manipulate the lockfile surgically.

**NEVER** delete the entire `pubspec.lock` file and run `dart pub get`. This causes uncontrolled upgrades across the entire dependency graph.

**Task Progress:**
- [ ] Open `pubspec.lock`.
- [ ] Locate the specific YAML block for the conflicting or retracted package.
- [ ] Delete ONLY that package's entry from the lockfile.
- [ ] Run `dart pub get` to fetch the newest compatible, non-retracted version for that specific package.
- [ ] **Feedback Loop:**
  - [ ] Run `dart pub deps` -> verify the dependency graph resolves correctly.
  - [ ] If resolution fails, identify the transitive dependency causing the lock, update its constraint in `pubspec.yaml`, and retry.

## Examples

### Tightening Constraints
When `dart pub outdated` shows a package is resolvable to a higher minor/patch version, use the `--tighten` flag to update the `pubspec.yaml` automatically.

**Input (`pubspec.yaml`):**
```yaml
dependencies:
  http: ^0.13.0
```

**Command:**
```bash
dart pub upgrade --tighten http
```

**Output (`pubspec.yaml`):**
```yaml
dependencies:
  http: ^0.13.5
```

### Surgical Lockfile Removal
If `package_a` is retracted or locked in a conflict, remove only its block from `pubspec.lock`.

**Before (`pubspec.lock`):**
```yaml
packages:
  package_a:
    dependency: "direct main"
    description:
      name: package_a
      url: "https://pub.dev"
    source: hosted
    version: "1.0.0" # Retracted version
  package_b:
    dependency: "direct main"
    # ...
```

**Action:** Delete the `package_a` block entirely. Leave `package_b` untouched. Run `dart pub get`.

© dart-lang · BSD-3-Clause · dart-lang/skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor