how do I point latest Dart version to this project? - flutter

I am trying to run the code on below project but has been noticing the error about Dart SK version (See below error).
Tried: pub get on YML file, get dependencies on main.dart file but same error. Any help? I read earlier resolution which says adding the version at YML file but it did not work. I also, installed the 2.17.6 in my machine and configured the Environment variable but no luck. Help please
Project from Github:
git clone https://github.com/flutter/codelabs.git
cd codelabs/boring_to_beautiful/step_01/
Error on Android Studio:
Waiting for another flutter command to release the startup lock...
Running "flutter pub get" in step_01...
The current Dart SDK version is 2.17.1.
Because myartist requires SDK version >=2.17.6 <3.3.0, version solving failed.
pub get failed (1; Because myartist requires SDK version >=2.17.6 <3.3.0, version solving failed.)
Process finished with exit code 1
The pubspec.yml has below
environment:
sdk: ">=2.17.6 <3.3.0"

Related

Visual Studio Code Can't Run Flutter - looking at wrong dart version

I have created a new flutter Project, but when I run it on Visual Studio Code by clicking on "Start Debugging" the following errors pops up:
[button_test] flutter pub get
Running "flutter pub get" in button_test...
The current Dart SDK version is 2.17.6.
Because button_test requires SDK version >=2.18.4 <3.0.0, version solving failed.
pub get failed (1; Because button_test requires SDK version >=2.18.4 <3.0.0, version solving failed.)
exit code 1
So I've double checked the dart version by entering dart --version. But this came back as 2.18.6
The funny thing is that if I enter flutter run on the Terminal, it works no problem. As I've installed the flutter and dart extension, I believe this is a problem with those extension? With that said, is there a way to fix which version of dart it's looking at?
Thanks
Step 1:
Open terminal and Navigate to the flutter location
cd <flutter_path>
Step 2:
Now enter the command
git checkout
You can find all the releases from this link https://docs.flutter.dev/development/tools/sdk/releases
Step 3:
Now run flutter doctor -v command so flutter will download the stuff related to the particular version
flutter doctor -v
Once the flutter doctor command is successful you can go ahead and enjoy the version you wish

Error when reading 'migrate': No such file or directory

I want to use migration tool as described here.
But I get Error: Error when reading 'migrate': No such file or directory
Here my dart version and error
xxx#xxx-:~/Desktop/xxx$ dart --version
Dart VM version: 2.4.0 (Unknown timestamp) on "linux_x64"
xxx#xxx-I:~/Desktop/xxx$ dart migrate
Error: Error when reading 'migrate': No such file or directory
pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
**
First solution :**
dart --version
If the dart sdk version is less than 2.12.0
Then try:
Flutter upgrade --force
or
dart upgrade
If dart migrate still doesn'tt work then jump to the second solution
Second solution :
since dart is already downloaded as part of flutter
Make sure first that it hasn't been downloaded twice
on Mac try :
where dart
on MS windows , check your path in the environment variables.
If there was more than one path for the dart sdk , then this is problem
In my case I had it installed twice
/usr/local/bin/dart
/Users/USER/Documents/flutter/bin/dart
so I removed the first one by (mac os)
rm /usr/local/bin/dart
The moment I did that the issue was fixed.
Try
dart --version
again and you should be having the latest version of dart that comes with flutter and you should be able to run succsfully
dart migrate

"The current configured Flutter SDK is not known to be fully supported. Please update your SDK and restart IntelliJ"

I have a problem that I'm trying to solve since last week, I've been searching about this issue and nothing works. I tried to reinstall the flutter and didn't work aswell. The image below is the first issue I have.
Then I went to "Tools -> Flutter -> Flutter Upgrade" and it shows me this message:
C:\src\flutter\bin\flutter.bat --no-color upgrade
fatal: unterminated line in .git/packed-refs: ...
Building flutter tool...
Running pub upgrade...
ProcessException: Process exited abnormally:
fatal: unterminated line in .git/packed-refs: ...
Command: git fetch --tags
Process finished with exit code 1
And when I tap to "Run 'main.dart'", it shows me this message:
fatal: unterminated line in .git/packed-refs: ...
Building flutter tool...
Running pub upgrade...
Running "flutter pub get" in olx...
The current Flutter SDK version is 0.0.0-unknown.
Because carousel_pro 1.0.0 requires Flutter SDK version >=1.2.0 <2.0.0 and no versions of carousel_pro match >1.0.0 <2.0.0, carousel_pro ^1.0.0 is forbidden.
So, because olx depends on carousel_pro ^1.0.0, version solving failed.
pub get failed (1; So, because olx depends on carousel_pro ^1.0.0, version solving failed.)
What could I do to fix these issues?
(Thanks for listening :)
Here the issue is raised due to Flutter SDK version because it is unknown.
These are some steps that I have followed to solve this problem
Run the following git command into your terminal
=> git clone -b master https://github.com/flutter/flutter.git
(this command will clone a flutter folder which contains latest version of Flutter SDK. get more info about SDK - here)
after cloning, we just need to move cloned folder to our default location of flutter SDK.
In my case path of flutter SDK is as follows(ubuntu) -
=> file:///home/bulbul/snap/flutter/common/flutter
I replaced the last flutter folder with the folder which I have cloned before.
then I ran the "flutter --version" command for getting the version of flutter SDK and it gave me the latest version of flutter SDK and the problem was solved.
It worked for me hopefully It will work for you as well.
Happy learning :)
Use the latest flutter SDK then check if the git is available from the command line using git --version. If it's not available from the command line android studio terminal then add git to system path variable and restart android studio.

Flutter Dart on windows 10

When I am running any command that uses dart the response is always as follows;
building flutter tool...
Running Pub upgrade...
The current Dart SDK version is 2.10.0-0.0.dev.flutter-9dca49e71e.
Because flutter_tools depends on collection >=1.15.0-nnbd <1.15.0-nullsafety.2 which requires SDK version >=2.9.0-18.0 <=2.9.10, version solving failed.
I am not able to switch the version nor the channel as those commands run through the same response.
I tried to uninstall flutter and dart, but I have only gotten back to the same issues.
Any help?
Navigate to where to your flutter install directory e.g. C:\Tools\Flutter and do a git pull.
After that you should be able to run any command, such as flutter --help and the Dart SDK will be on the correct version.
This can be verified by running flutter upgrade
I just needed to update my Path ENV Variable

Flutter package targeting min version

I published a package to pub.dev that uses the Flutter SDK version 1.6.3 which as of today is the beta channel
However the pub analyser uses v1.5.4-hotfix.2 which does not have those API changes just yet, presummably because it is using on the stable channel
When I specified the min version in the pubspec.yml file for flutter it outright failed
STDERR:
ERR : The current Flutter SDK version is 1.5.4-hotfix.2.
|
| Because ...... requires Flutter SDK version ^1.6.3, version solving
failed.
pub finished with exit code 1
Is there a way to get the pub website to accept the beta channel builds and not have the package fail?
I've found this thread https://github.com/dart-lang/pub-dev/issues/2283 and seems you have to use the stable channel version to publish a package
try to change sdk
or
try to upgrade Flutter Package
tools>>flutter>>flutter Upgrade