Flutter version solved failed - flutter

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)

Related

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"

flutter requires SDK version, but version is correctly installed

$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.

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

Get packages not working because of version failing

Not much to add but why would pub get fail with this error..
The current Dart SDK version is 2.9.0-14.1.beta.
Because pos_app requires SDK version >=2.9.0 <3.0.0, version solving failed.
pub get failed (1; Because pos_app requires SDK version >=2.9.0 <3.0.0, version solving failed.)
exit code 1
i had the same problem, fixed switching to flutter dev channel (in my case) and upgrading version to match the requirements.
run flutter doctor -v
you'll see that your flutter sdk version runs a dart sdk that not match the project requirements, even if you installed the latest version of dart sdk on your ide. (this made me confused)

Flutter lower dart version

I'm getting the following error due to Dart version of my flutter setup when I run the flutter get packages command:
[project_name] flutter packages get Running "flutter packages get"
in project_name...
The current Dart SDK version is
2.1.0-dev.0.0.flutter-be6309690f.
Because project depends on intl_translation >=0.14.0+1 <0.17.0 which
requires SDK version >=1.12.0 <2.0.0, version solving failed. pub get
failed (1) exit code 1
My framework version:
Flutter 0.6.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 9299c02cf7 (2 weeks ago) • 2018-08-16 00:35:12 +0200
Engine • revision e3687f70c7
Tools • Dart 2.1.0-dev.0.0.flutter-be6309690f
I would like to learn if there's some kind of command to lower dart-sdk version of the flutter framework, thanks in advance.
In the Flutter install directory execute
git checkout v"0.5.0" // for example
You can check which versions are available in the Flutter GitHub repository https://github.com/flutter/flutter
You can only change the Dart version if you change to a Flutter version that contains the desired Dart version.
Change the dependency to
dev_dependencies:
intl_translations: ^0.17.0
Add following dependency in pubspec.yaml file
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"