18

Can anyone tell me why am I getting this error?

The current Dart SDK version is 2.12.0.

Because app requires SDK version >=2.15.1 <3.0.0, version solving failed.
pub get failed (1; Because app requires SDK version >=2.15.1 <3.0.0, version solving failed.)

here is my flutter --version

Flutter 2.10.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision db747aa133 (2 days ago) • 2022-02-09 13:57:35 -0600
Engine • revision ab46186b24
Tools • Dart 2.16.1 • DevTools 2.9.2

Anurag Yadav
  • 199
  • 1
  • 1
  • 9
  • Just change the sdk version in your pubspec.yaml to the requested version. Your pubspect should have something like this `sdk: ">=2.12.0 <3.0.0"` is change to this `sdk: ">=2.15.1 <3.0.0"`. – Chance Feb 11 '22 at 13:50

12 Answers12

26

Run flutter upgrade, after run flutter pub get

ncutixavier
  • 455
  • 5
  • 4
10

You should not update the dart version of this project, please open pubspec.yaml file and update

environment: sdk: ">=2.12.0 <3.0.0"

to

environment: sdk: ">=2.16.0 <3.0.0"

Qasim
  • 249
  • 1
  • 7
3

I have had the same issue. Go to pubspec.yaml and change then make it :

environment:
  sdk: '>=2.15.1 <3.0.0'

No need to upgrade flutter if you are already in the latest version. Just do this and I hope this will work.

Som
  • 61
  • 1
  • 6
2

I think you should update dart version, can upgrade dart version this link

Yasin Ege
  • 605
  • 4
  • 14
2

like @Yasin Ege says, dart need to upgrade in order to use:

flutter channel <channel to update master or beta>
flutter upgrade
bebetor
  • 21
  • 2
0

you can resolve this error by changing : flutter_lints: ^2.0.0 To flutter_lints: ^1.0.0 in pubspace.yaml.

Hamed
  • 5,867
  • 4
  • 32
  • 56
0
flutter channel <master or beta>
flutter upgrade

But if you check dart --version is the version that matches the version the project requires and still get the error "version solving failed." like this.

enter image description here

flutter clean
flutter channel <master or beta>
flutter upgrade --force
0

When prompting your command just use flutter pub add ... instead of dart

Finley Adams
  • 773
  • 1
  • 8
  • 20
0

Go pubspec.yaml and edit minimun to your dart version

From environment: sdk: ">=2.15.1 <3.0.0"

To environment: sdk: ">=2.12.0 <3.0.0"

Sir Joe
  • 41
  • 2
0

it only run 'flutter upgrade' is ok.

小蜜蜂
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 01 '23 at 22:31
0

Go to your terminal and find the dart version by using this command dart --version. Copy your dart version and go to pubspec.yaml file and change your sdk version >=2.19.6 <3.0.0 to your current dart version. You have to replace version that is left side.

error with Dart SDK version in given image:

error with Dart SDK version in given image

replace the highlighted version to your current Dart SDK version:

replace the highlighted version to your current Dart SDK version

your current Dart SDK version is here:

your current Dart SDK version is here

Your problem will be resolved easily by following these simple steps

Esmaeil Ahmadipour
  • 840
  • 1
  • 11
  • 32
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 08 '23 at 12:02
0

If no of theme worked try this

flutter pub cache repair

flutter pub get
samad shukr
  • 561
  • 7
  • 15