Reputation: 409
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
Reputation: 1049
If none of them worked, try this instead
flutter pub cache repair
flutter pub get
Upvotes: 0
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:
Replace the highlighted version to your current Dart SDK version:
Your current Dart SDK version can be found here:
Your issue can be easily resolved by following these straightforward steps.
Upvotes: 1
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.`
first check your dart version in your terminal by text : dart --version enter image description here
go to pubspec.yaml and change your env sdk to your current sdk before
Upvotes: 1
Reputation: 417
try this steps :-
delete pubspec.lock
file.
run flutter clean
command.
run flutter upgrade
command.
run flutter pub get
.
try run your project.
Upvotes: 0
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
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
Reputation: 831
When prompting your command just use flutter pub add ...
instead of dart
Upvotes: -1
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.
flutter clean
flutter channel <master or beta>
flutter upgrade --force
Upvotes: 0
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
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
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