Dart/Flutter "version solving failed" in CI
Pub could not find a set of package versions that satisfies every constraint in pubspec.yaml at once. Two packages - or a package and your Dart/Flutter SDK constraint - demand incompatible versions.
What this error means
flutter pub get (or dart pub get) fails with "version solving failed", explaining which constraints conflict. It is deterministic and reproduces locally with the same pubspec.yaml.
Because app depends on both http ^1.2.0 and legacy_pkg 0.5.0 which depends on
http ^0.13.0, version solving failed.
Running "flutter pub get" in app... failed.Common causes
Incompatible package constraints
Two dependencies require non-overlapping versions of a shared package. Pub will not silently pick one - it reports the conflict.
An SDK constraint that excludes a release
Your environment: sdk: (or flutter:) bound may not overlap a package’s required SDK, leaving no solvable version.
How to fix it
Read the conflict and relax a constraint
- Identify the two requirements that conflict in the message.
- Loosen your own caret pin so the ranges overlap, if possible.
- If two third-party packages conflict, upgrade the lagging one to a release that accepts the newer shared dependency.
Let pub suggest an upgrade path
dart pub get --verbosity=all
dart pub upgrade --major-versionsAlign the SDK constraint
Make sure your environment bound overlaps every dependency’s requirement.
environment:
sdk: ">=3.4.0 <4.0.0"
flutter: ">=3.24.0"How to prevent it
- Commit
pubspec.lockfor apps so CI installs the resolved set. - Keep your SDK constraint aligned with your dependencies’ support.
- Upgrade related packages together to keep shared deps compatible.