Dart's pub get command can't find latest versions of some dependencies


I’ve noticed on a few occasions that when I setup some dependencies in my pubspec.yaml pointing to the latest version, they aren’t found when I run pub get.

For instance, the dependency source_gen. The latest version of source_gen is clearly 0.5.0+1. So I’ll setup my pubspec.yaml file as follows:

  source_gen: "^0.5.0+1"

Then I run pub get, and I get the following error:

Resolving dependencies...
Package source_gen has no versions that match >=0.5.0+1 <0.6.0 derived from:
- ServerErrors depends on version ^0.5.0+1

I tried several of the most recent versions, without much luck. Finally if I do the following:

  source_gen: any

and then run pub get, source_gen version 0.4.7 is installed. I’m not sure I understand why. I’m using the dart sdk version 1.16.0. This is the second dependency I’ve had this issue with and I’m a little confused.

EDIT: As requested by Gunter, the full list of my dependencies:

  http: "^0.11.3+7"
  dartson: "^0.2.5"
  intl: "^0.12.7+1"
  mailer: "^1.0.0"


That’s a known issue of pub. This means pub just wasn’t able to resolve a compatible set of dependencies. Unfortunately the error message is misleading.
pub also prints the same error when one of the dependencies isn’t compatible with the used Dart SDK version.

Answered By – Günter Zöchbauer

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.