0
votes

Every flutter command gives this error:

Building flutter tool... Running pub upgrade... The current Dart SDK version is 2.5.0.

Because flutter_tools requires SDK version >=2.7.0 <3.0.0, version solving failed. Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)

Waiting for 0 seconds, press CTRL+C to quit ...

Not able to run a single flutter command, what's the issue

2

2 Answers

0
votes

You need to fix environment: in pubspec.yaml to allow the Dart SDK version you are using (the one from Flutter)

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

OR

First Make sure you have a working internet connection and if this issue still exists then, this error may be because the dart sdk may have not been properly downloaded. The simplest solution is to delete the cache folder located in flutter/bin(location where flutter is installed) and then Run flutter doctor

  1. Check if you are connected to the internet and because flutter needs to IDE needs to download some dependencies and load them when the IDE starts.
  2. Disable your Anti Virus because it stops flutter doing Flutter Upgrade, once you are down check if there's an issue with your Flutter Doctor.
  3. Delete the cache folder which is located inside

flutter/bin

(where flutter is installed) and then Run Flutter Doctor

  1. Last option would be to delete your Flutter SDK and download a new one, with your you can know who was the culprit who stopped your projects from running.
0
votes

Reinstalling flutter sdk works!