Anurag Yadav
Anurag Yadav

Reputation: 409

Because app requires SDK version >=2.15.1 <3.0.0, version solving failed

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

Upvotes: 38

Views: 137539

Answers (14)

samad shukr
samad shukr

Reputation: 1049

If none of them worked, try this instead

flutter pub cache repair

flutter pub get

Upvotes: 0

Usama Baig
Usama Baig

Reputation: 31

Open your terminal and use the following command to determine your Dart version: 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 on left side 2.19.6.

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 can be found here:

your current Dart SDK version is here

Your issue can be easily resolved by following these straightforward steps.

Upvotes: 1

Bagus Rizky M
Bagus Rizky M

Reputation: 11

here is my problem

`Resolving dependencies... The current Dart SDK version is 3.2.3.

Because al_quran_app requires SDK version >=3.10.6 <4.0.0, version solving failed.`

  1. first check your dart version in your terminal by text : dart --version enter image description here

  2. go to pubspec.yaml and change your env sdk to your current sdk before

after

  1. run flutter clean, and then run flutter pub get

Upvotes: 1

Taher Salah
Taher Salah

Reputation: 417

try this steps :-

  1. delete pubspec.lock file.

  2. run flutter clean command.

  3. run flutter upgrade command.

  4. run flutter pub get .

  5. try run your project.

Upvotes: 0

小蜜蜂
小蜜蜂

Reputation: 1

it only run 'flutter upgrade' is ok.

Upvotes: 0

Som
Som

Reputation: 101

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.

Upvotes: 6

Sir Joe
Sir Joe

Reputation: 41

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"

Upvotes: 0

Finley Adams
Finley Adams

Reputation: 831

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

Upvotes: -1

BrilliantPy
BrilliantPy

Reputation: 51

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

Upvotes: 0

John At
John At

Reputation: 1

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

Upvotes: 0

ncutixavier
ncutixavier

Reputation: 651

Run flutter upgrade, after run flutter pub get

Upvotes: 41

bebetor
bebetor

Reputation: 31

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

flutter channel <channel to update master or beta>
flutter upgrade

Upvotes: 3

Qasim
Qasim

Reputation: 277

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"

Upvotes: 12

Yasin Ege
Yasin Ege

Reputation: 723

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

Upvotes: 2

Related Questions