I am getting an error in flutter setup in android studio in windows, i already updated and having latest version of flutter and android studio - flutter

After completing all steps like SDK download, path setup in windows getting this error in flutter setup.
This error is occuring before creating flutter project.
The current Dart SDK version is 2.9.2. Because flutter_tools depends on test >=1.16.0-nullsafety which requires SDK version >=2.10.0-0 2.11.0, version solving failed. pub get failed (1; Because flutter_tools depends on test >=1.16.0-nullsafety which requires SDK version >=2.10.0-0 2.11.0, version solving failed.)

Please show your pubspec file. If you have tried all possible solutions and can't figure out the issue, I would say to try and reinstall it.

Related

Can't pub-get from pubspec.yaml file in Flutter app

Every time I want to install a package it gives this error, how do I fix it? The error output is below:
The current Dart SDK version is 2.12.3.
The current Flutter SDK version is 0.0.0-unknown.
Because image_picker >=0.3.0 requires Flutter SDK version >=0.1.4 and image_picker <0.3.0 requires SDK version >=1.8.0 <2.0.0, image_picker is forbidden.
So, because firebase depends on image_picker any, version solving failed.
Running "flutter pub get" in firebase...
pub get failed (1; So, because firebase depends on image_picker any, version solving failed.)
You check your flutter version and check that dependency version and change the dependency version otherwise remove the version.
You have to either:
Downgrade the version of image_picker to match the flutter SDK version you currently use, or
Upgrade your flutter SDK version to a version above or equal to 1.8.0. (preferred solution).

sdk version solving failed error on executing code

I am beginner in flutter. Doing a course from Udemy but facing lots of problems.I am making shop app.
The current Flutter SDK version is 0.0.0-unknown.
I'm getting the below error when I run it in Android Studio
Because shop_app depends on provider >=4.0.0-dev which requires
Flutter SDK version >=1.12.1, version solving failed. pub get failed
(1; Because shop_app depends on provider >=4.0.0-dev which requires
Flutter SDK version >=1.12.1, version solving failed.)

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 issue - Flutter_driver from sdk depends on file 5.0.6 and flutter_gallery depends on file 5.0.7

I got this issue using flutter packages get:
Because every version of flutter_driver from sdk depends on file 5.0.6 and flutter_gallery depends on file 5.0.7, flutter_driver from sdk is forbidden.
So, because flutter_gallery depends on flutter_driver any from sdk, version solving failed.
pub upgrade failed (1)
I don't know what I am supposed to do here, I was trying to compile this flutter example: https://github.com/flutter/flutter/tree/master/examples/flutter_gallery
This may be because flutter dependencies are locked to fixed versions.
You can check this in the pubspec.yaml for flutter_driver which is in
\flutter\packages\flutter_driver
and compare it to the latest version at GitHub
If so, flutter upgrade won't necessarily update the dependencies versions. Doing a forced update of the packages may resolve your problem.
flutter update-packages --force-upgrade

How to run flutter projects with different/older Dart SDK dependencies?

The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because NewsBuzz requires SDK version >=1.8.0 <2.0.0, version solving failed.
I am trying to run projects from https://startflutter.com. There are several older projects using older versions of Dart SDK or with dependencies requiring older Dart SDK version.
Is there any way to run multiple versions of Dart without downloading the older version of Dart and changing the environment variables manually?
I have gone through several StackOverflow posts and lot of Github issues without finding a proper solution.
Flutter lower dart version
Where is Dart's SDK located within /flutter folder?
Specifying SDK version in the pubspec.yaml does not seem to help.
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
Edit: Dart & Flutter support for Visual Studio Code docs says something about dart.sdkPaths and dart.flutterSdkPaths settings.
I had a similar problem:
My pubspec.yaml had the following:
environment:
sdk: ">=2.1.0 <3.0.0"
However when running flutter packages get I got the following error:
Running "flutter packages get" in xxx-app-mobile...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because xxx_app requires SDK version >=2.1.0 <3.0.0, version solving failed.
pub get failed (1)
I tried using the exact version name as the environment variable it did not work. I tried:
flutter upgrade
flutter clean
flutter update-packages
Received the same error when running flutter packages get
I then downgraded the version requirements in the pubspec.yaml to:
environment:
sdk: ">=2.0.0 <3.0.0"
And flutter packages get worked...
So I had an app that was developed on flutter 1.x SDK's, but after my completion, I moved on to build other projects and eventually shifted to fllutter2.0
As of now, flutter downgrade only lets you go one version back, Also going back from 2.x to 1.x seems difficult
So I went to this https://docs.flutter.dev/development/tools/sdk/releases site and downloaded the version i made the app in.
Then I had my dart-sdk for that specific project changed in Android Studio
Then I did the following
Deleted .idea folder and build folder as well as pubspec-lock file.
run flutter pub get
finally flutter build apk
Now this was a dire situation so I had to resort to this
I really will not recommend this unless you are in a rough spot
Simply update you flutter sdk to latest version.
First open your command (cmd) as an adminstrator then upgrade flutter : flutter upgrade it will do everything for you