unable to upgrade flutter on mac - flutter

I am unable to update flutter on osX.
When I run:
flutter doctor
I get the following error:
Because flutter_tools depends on xml >=3.5.0 which requires SDK version >=2.3.0 <3.0.0, version solving failed.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
The current Dart SDK version is 2.3.0-dev.0.5.flutter-a1668566e5.
I have not idea how to solve this issue since I cannot issue any flutter commands.
I tried to cd into the flutter/bin directory and do :
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
But this did not solve my issues.
Any ideas ? I don't have sudo rights.

Related

FirebaseAppPlatform.verifyExtends error while running flutter test

When I run my bitbucket pipeline for my project im getting an error during flutter test:
/root/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'.
FirebaseAppPlatform.verifyExtends(_delegate);
^^^^^^^^^^^^^
When I run flutter test in my terminal I don't have these issues.
My pipeline script is:
Build Setup
flutter clean
flutter pub get
flutter pub run build_runner build
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
flutter test
Because there are some breaking change of firebase_core_platform_interface that do not comply with semantic versioning:
https://github.com/firebase/flutterfire/issues/9806
You need to overwrite this library:
Root cause
You are update or installing only a subset of the Firebase plugins (firebase_core, firebase_analytics,...)
Solution
Solution 1: (preferred) Updating to the latest version with flutterfire update check the docs here. But it is not easily because your project will have a lot of packages dependencies to each other like flutter version 2 or 3, so on. Anyway, it is long term solution.
Solution 2: (Fix to run)
You can add to your pubspec.yaml
dependency_overrides:
firebase_core_platform_interface: 4.5.1
Solution 3: (Fix to run)
Update dependencies with this below command line:
flutter pub upgrade --major-versions
Finally, Run the project again by following stuffs:
flutter clean
flutter pub get
cd ios && rm -f Podfile.lock
cd ios && pod install --repo-update
flutter run
That's it!
Run "flutter pub upgrade --major-versions"
run this
flutter pub upgrade --major-versions
than run this
flutter upgrade
I changed my flutter version via flutter channel master. This changed automatically my pubspec.lock.
In my case, restoring previous version of pubspec.lock solved the problem (pug get needed).

"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 - Error: Unable to create dart snapshot for flutter tool

When I run flutter change channel or flutter doctor, the CMD show me this:
C:\Users\MyUser>flutter doctor -v
Checking Dart SDK version...
Building flutter tool...
Running pub upgrade...
/C:/src/flutter/packages/flutter_tools/lib/src/aot.dart:144:5: Warning: Must explicitly return a value from a non-void function.
return;
^
When I run:
git clean -xfd
git pull
flutter doctor
The CDM show me this:
fatal: not a git repository (or any of the parent directories): .git
How can I solve it? Thank you
Had the same issue...Copied the flutter_tools from flutter download and replaced with the same folder in my installation then ran flutter doctor from command in administrator mode.
Funny the issue started 3 days ago for me too.
1.Go the Flutter install directory and please run (in cmd)
git clean -xfd
git stash save --keep-index
git stash drop
git pull
2.and restart your computer
then run
flutter doctor
3.then go to your project path run
flutter packages get
flutter run
I had the exact same problem yesterday, i tired to run
git clean -xfd
git pull
flutter doctor
in cmd and i kept getting:
fatal: not a git repository (or any of the parent directories): .git
eventually i gave up and i deleted the old flutter sdk directory from my PC as well as the path from Enviroment Variables and i downloded the new sdk and setup flutter again and now it's running fine
https://docs.flutter.dev/get-started/install
On windows, delete flutter folder C:\Users\User\AppData\Local\Pub
This is the flutter temp/cache folder and may contain outdated versions of the libraries
unfortunately none of the given solution so far works for me..
I had to the following steps, which was the only solution for me:
delete the whole flutter folder
extract (or copy) it from the zip-file to your installation directory (in my case I just downloaded the latest flutter version, because I didn't have access to the previous downloaded zip-file anymore)
open the IDE in the installation directory (or open the associated project)
run flutter pub get

How can install Flutter Correctly in Windows

I use this line in C:\src
git clone -b stable https://github.com/flutter/flutter.git
And in PATH i type this line:
C:\src\flutter\bin
Then
flutter doctor
but output is :
How can i install Flutter correctly?
some error is:
Error: 'pub upgrade' still failing after 10 tries, giving up.
Error: Error when reading '.packages': The system cannot find the file specified.
Error: Error when reading '../../bin/cache/flutter_tools.snapshot': The system cannot find the file specified.
I had the same problem days ago, what I did is
Remove cache folder inside bin/cache
Run flutter doctor again
Also I just cloned the master branch and then run flutter doctor
git clone -b master https://github.com/flutter/flutter.git
And if it doesn't work, most likely is what #user11945700 is saying, something about Antivirus or Firewall, so I recommend you to disable everything, install it, and then activate again.
Otherwise if you want other version you may use this to dowload Flutter releases versions
Another guess, could you install it if you run the prompt shell as administrator?
I use this link
https://flutter.dev/docs/development/tools/sdk/releases?tab=windows
extract file in C:/src
in
C:/src/flutter/bin
Run:
flutter doctor
This link help you to install Flutter:
https://www.aparat.com/v/Da9IN/%D8%A2%D9%85%D9%88%D8%B2%D8%B4_%DA%A9%D8%A7%D9%85%D9%84_%D9%86%D8%B5%D8%A8_flutter
If in your system antivirus or firewall is there then mostly its due to that. try after suspending antivirus and firewall
You also have one option directly download stable version from here - https://flutter.dev/docs/development/tools/sdk/releases

Why flutter doctor doesn't verify everything up correctly?

I follow the flutter documentation correctly. I'm done installing flutter SDK, put it at the correct path(c:\src\flutter[my flutter]), open the flutter_console.bat, locate at the command line cd c:/src/flutter, run flutter doctor, to see if there is anythin I need to do, I found one
And I get this error
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b stable https://github.com/flutter/flutter.git
And run the following command cd c:/src/flutter> git clone -b stable https://github.com/flutter/flutter.git base on what the flutter doctor says
After, I run flutter doctor again, and GET THE SAME ERROR.
Am I wrong?
I have the command prompt and powershell 5.1, my system requirements fits the criteria on running flutter apps.
I expect I don't have any issue running flutter doctor again
It seems you got the wrong path of the SDK.
Maybe this is a bug with flutter doctor.
Check yout flutter SDK version first,the latest version have fixed the issue.