flutter requires SDK version, but version is correctly installed - flutter

$fvm flutter run
Running "flutter pub get" in flutterweb...
The current Dart SDK version is 2.13.4.
Because flutterweb requires SDK version >=2.14.0 <3.0.0, version solving failed.
I have this error.
Hoever --version is 2.14.2
$ dart --version
Dart SDK version: 2.14.2 (stable) (Wed Sep 15 12:32:06 2021 +0200) on "macos_x64"
in pubspec.yaml
environment:
sdk: ">=2.14.0 <3.0.0"
Where should I check??

I did it this way: Open the cmd as Administrator, and run:
flutter upgrade
This works for me.

Which Flutter version are you using? 2.5?
Because different flutter versions require different dart versions. You should try flutter upgrade and if that doesn't fix it, try flutter channel stable.

Related

Flutter version solved failed

I get this error msg and iam not sure how to solve this, i switched to stable channel and runned flutter upgrade:
Downloading ios tools...
Downloading ios-profile tools...
Downloading ios-release tools...
Running "flutter pub get" in projectname...
The current Dart SDK version is 2.18.2.
Because projectname requires SDK version >=2.19.0-197.0.dev <3.0.0, version solving failed.
pub get failed (1; Because projectname requires SDK version >=2.19.0-197.0.dev <3.0.0, version solving failed.)
Exited (1)
Possible solution:
check flutter and dart version:
flutter --version
dart --version
On mac go to Android Studio -> Preferences -> languages ​​& frameworks -> dart
(check here if it's pointing to something like "/Users/waldsonfagundes/development/flutter/bin/cache/dart-sdk" what matters if is if it is pointing inside the flutter folder dart-sdk).
The version appears just below the path (Ex.: 2.18.0)
On mac go to Android Studio -> Preferences -> languages ​​& frameworks -> flutter
check the version in this path too
the stable version today is:
Flutter 3.3.4 and dart 2.18.2
update the file:
pubspec.yaml
environment:
sdk: ">=2.18.0 <3.0.0"
dart version 2.19.0 and beta version still in flutter:
https://docs.flutter.dev/development/tools/sdk/releases?tab=macos
downgrade the version:
flutter downgrade (example: flutter downgrade v3.3.4)

flutter android studio

The current Dart SDK version is 2.15.1.
Because flutter_projects requires SDK version >=2.17.6 <3.0.0, version solving failed.
but the dart version is 2.19.0
I'm guessing that you can just update pubspec.yaml file. Write this instead.
environment:
sdk: ">=2.15.1 <3.0.0"
Or upgrade your flutter version by running:
flutter upgrade

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
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"
Run flutter upgrade, after run flutter pub get
I think you should update dart version, can upgrade dart version this link
like #Yasin Ege says, dart need to upgrade in order to use:
flutter channel <channel to update master or beta>
flutter upgrade
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.
you can resolve this error by changing :
flutter_lints: ^2.0.0 To flutter_lints: ^1.0.0 in pubspace.yaml.
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
When prompting your command just use flutter pub add ... instead of dart
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"

Flutter create has a prblem doing the get cos it thinks my dart version is too low

I am creating a flutter project with flutter create. as part of that i guess it runs flutter pub get. but that fails cos:
[chat_app] flutter pub get
Running "flutter pub get" in chat_app...
The current Dart SDK version is 2.14.2.
Because chat_app requires SDK version >=2.15.1 <3.0.0, version solving failed.
pub get failed (1; Because chat_app requires SDK version >=2.15.1 <3.0.0, version solving failed.)
exit code 1
when i run dart --version it says
Dart SDK version: 2.15.1 (stable) (Tue Dec 14 13:32:21 2021 +0100) on "windows_x64"
Im not sure whats happening
you should upgrade your project sdk to 2.15.1.
go to you project folder, open pubspec.yaml file and change sdk to 2.15.1
environment:
sdk: ">=2.15.1 <3.0.0"

The current Dart SDK version is 2.10.4. how can I change the version into a upper version .? In a beta or dev channel

Because classbe depends on cupertino_icons >=1.0.1 which requires SDK version >=2.12.0-0 <3.0.0, version solving failed.
Running "flutter pub get" in classbe... pub get failed (1; Because classbe depends on cupertino_icons >=1.0.1 which requires SDK version >
Update your pubspec.yaml depending on the flutter channel you want to work on:
If you are on stable channel :
environment:
sdk: ">=2.10.5 <3.0.0"
dependencies:
cupertino_icons: ^1.0.0
If you are on beta channel :
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
cupertino_icons: ^1.0.1
Then if you are on stable channel (or beta),
flutter channel stable
# or flutter channel beta
flutter upgrade
flutter pub get
flutter channel beta
flutter upgrade
You'll need to run a simple command from your terminal
flutter upgrade
If you work on Windows do the following:
Open PowerShell as Admin use
choco install dart-sdk
or to upgrade
choco upgrade dart-sdk
By default, the SDK is installed at C:\tools\dart-sdk
Than go to your IDE and check the location of your Dart SDK.
For Intellij use
File->Settings->Language & Framework->Dart->Dart SDK path
Her paste C:\tools\dart-sdk (by default)
Just upgrade your flutter
With command line:
flutter upgrade -v
My issue was different, i had changed my flutter and dart version in android studio but it was not reflecting in vs code, what I did was
I open a flutter file
at the bottom of vscode, there is a place were {} Dart is written I clicked on it and then it open up the the command palette, so I clicked on "Configure Dart language based setting"
This then open the dart configuration and I changed "dart.flutterSdkPath" to the path where my current SDK and it fixed the problem.
You can also use this for the above just download the flutter SDK you want to use to a location and follow the step I stated above