Conflicts
Type 1: Pinned Dependency
Suppose XYZ dependency is pinned to 1.0.0, while your project uses 1.0.1, in that case, the flutter version you're using is using 1.0.0 & you’re trying to use 1.0.1 in your project, which is not possible. So to fix this you have to wait for the new Flutter version/ keep using the old version of the dependency until Flutter pins the new one/ override the dependency (And if you override the dependency to 1.0.1 then Flutter will be forced to use that version)
| Scenario | Action | Result |
|---|---|---|
| XYZ dependency pinned to 1.0.0 | Project uses 1.0.1 (after upgrade) | Conflict: Flutter uses 1.0.0 (pinned) |
| Wait for new Flutter version | Ideal solution, but requires waiting | |
| Keep using old dependency (1.0.0) | Works, but limits project to older version | |
| Override dependency to 1.0.1 (in pubspec.yaml) | Forces Flutter to use 1.0.1 (potential issues) |
Type 2: Dependency Conflicts
Suppose you have two dependencies in your project crop_photo: 1.0.0 & resize_photo: 1.0.0. Both have a transitive dependency on the dependency photo (crop_photo: 1.0.0 → depends on photo: ^2.0.1 & resize_photo: 1.0.0 → depends on photo: ^2.0.3), which was working great with the previous version of flutter because ^ allows you to use dependencies that are 1.0.x So for both the packages Flutter will use 2.0.3 or the latest 2.0.x. Now you upgrade flutter & upgrade both dependencies crop_photo: 1.0.1 & resize_photo: 1.0.4. Now crop_photo: 1.0.1 depends on photo: ^2.0.5 & resize_photo: 1.0.4 → depends on photo: ^3.0.0. Thus flutter fails to resolve the dependency as one depends on 2.x.x & other one depends on 3.x.x. To fix this you need to override the dependency (to either 2.x.x or 3.x.x provided with which one both will work fine)/ use old dependencies.
| Scenario | Action | Result |
|---|---|---|
| crop_photo 1.0.0 & resize_photo 1.0.0 | Both depend on photo: ^2.0.1 & ^2.0.3 (compatible with Flutter) | Works fine (Flutter uses compatible 2.x.x photo version) |
| Upgrade Flutter & Dependencies | crop_photo: 1.0.1 (depends on photo: ^2.0.5) & resize_photo: 1.0.4 (depends on photo: ^3.0.0) | Conflict: Incompatible photo version ranges (2.x.x vs 3.x.x) |
| Fix 1: Override dependency (to compatible version) | Forces Flutter to use a compatible photo version (either 2.x.x or 3.x.x) | |
| Fix 2: Use old dependencies | Revert to crop_photo: 1.0.0 & resize_photo: 1.0.0 |