Search code examples
flutterpackagepubspec

Version solving for certain package versions failed in flutter


I have received this kind error a couple of time before with different packages, usually i just try a combination of different versions till i finally get a match that works. Is there a way to know what package versions are compatible instead of using the trial error approach which is outright time consuming and exhausting.

Initially i though it could be that one of the packages depends on the other, like in this case maybe flutter_svg depends on a different version of flutter_luban so the version in my pubspec clashes with it, but none of these packages depend on one another after viewing the respective package dependencies.

pub get failed (1; So, because sakaHapa depends on both
flutter_svg ^0.17.4 and flutter_luban ^0.1.13, version solving
failed.)

Solution

  • You can use 'pub outdated' command like below.

    https://dart.dev/tools/pub/cmd/pub-outdated

    Here is column what means.

    • Current
      The version used in your package, as recorded in pubspec.lock. If the package isn’t in pubspec.lock, the value is -.

    • Upgradable
      The latest version allowed by your pubspec.yaml file. This is the version that dart pub upgrade resolves to. The value is - if the value in the Current column is -.

    • Resolvable
      The latest version that can be resolved, when combined with all other dependencies. This version corresponds to what dart pub upgrade gives you if all version constraints in pubspec.yaml are unbounded. A value of - means that the package won’t be needed.

    • Latest
      The latest version of the package available, excluding prereleases unless you use the option --prereleases.

    flutter pub outdated
    

    enter image description here