Why is this "illegal url" error appearing when running flutter doctor? - flutter

I have installed a new version of flutter in my macOS. But when trying to run
flutter doctor I get this
Downloading Dart SDK from Flutter engine <<<<<<< HEAD
05e680e202af9a92461070cb2d9982acad46c83c
=======
d3ea636dc5d16b56819f3266241e1f708979c233
>>>>>>> 18116933e77adc82f80866c928266a5b4f1ed645...
curl: (3) URL using bad/illegal format or missing URL
Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra_release/flutter/<<<<<<< HEAD
05e680e202af9a92461070cb2d9982acad46c83c
=======
d3ea636dc5d16b56819f3266241e1f708979c233
>>>>>>> 18116933e77adc82f80866c928266a5b4f1ed645/dart-sdk-darwin-x64.zip
If you're located in China, please see this page:
https://flutter.dev/community/china
Is there a known fix for this? I have looked for an answer, but they're mostly targeted towards Windows.

navigate to git folder
in git console: (be aware local changes are dismissed!)
git fetch --all
git reset --hard origin/master

This is what worked for me - deleted the flutter folder and replaced it with one from the official flutter webpage

Related

How to solve problem of git cloning while running flutter pub get for a dependency

I am currently working on an old flutter project. I want to install the necessary dependencies so that i can start making changes.
Now when i run the flutter pub get command, i get a certain error which is not explaining how to solve it.
pub get failed (server unavailable) -- attempting retry 10 in 64 seconds...
Git error. Command: git clone --mirror git://github.com/tekartik/platform.dart C:\src\flutter2\.pub-cache\git\cache\platform.dart-6f0f0462856ed9b1246d3c594e824b1b2d81f000
stdout:
stderr: Cloning into bare repository 'C:\src\flutter2.pub-cache\git\cache\platform.dart-6f0f0462856ed9b1246d3c594e824b1b2d81f000'...
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Unknown error
I think the point reached for downloading the dependency and it is not showing me where i can change from git:// to git#github
Below is a code snippet of the pubspec.yaml file where the dependency is to be installed
tekartik_app_platform:
git:
url: git#github.com:tekartik/app_flutter_utils.dart.git
ref: null_safety
path: app_platform
version: '>=0.1.0'
I am trying to get help on how to solve it because i only just got the code which is an old code and so am not sure where to go and make the fix.
Thank you alot in advance.
Try changing it to:
git:
url: https://github.com/tekartik/app_flutter_utils.dart
path: app_platform
ref: null_safety
More info on the packages can be found under: Dependencies on unpublished packages
https://docs.flutter.dev/development/packages-and-plugins/using-packages
I managed to find the solution. The ref value the project was using is null safety which still uses "git://" which is not being used by github anymore and so that is where the error is coming from.
So i changed to
tekartik_app_platform:
git:
url: git#github.com:tekartik/app_flutter_utils.dart.git
ref: dart2_3
path: app_platform
version: '>=0.1.0'
If this is the case for adding the plugin dependecy in flutter by git reference
Make sure you have public access for the same repository. if private then go to bottom of general setting and make it public.

Unable to update flutter

I am trying to run commands like flutter upgrade and flutter doctor and even when I try to check for channel flutter channel but it is showing me just these particular set of commands -
Downloading Dart SDK from Flutter engine <<<<<<< HEAD
2dce47073a378673f6ca095e91b8065544c3a881
=======
91c9fc8fe011352879e3bb6660966eafc0847233
>>>>>>> d79295af24c3ed621c33713ecda14ad196fd9c31...
curl: (3) URL using bad/illegal format or missing URL
Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra_release/flutter/<<<<<<< HEAD
2dce47073a378673f6ca095e91b8065544c3a881
=======
91c9fc8fe011352879e3bb6660966eafc0847233
>>>>>>> d79295af24c3ed621c33713ecda14ad196fd9c31/dart-sdk-darwin-x64.zip
If you're located in China, please see this page:
https://flutter.dev/community/china
If anyone has faced a similar problem or has any idea what to do...please help.
It looks like you have merge conflict markers in your Flutter SDKs internal files (for example bin/internal/engine.version).
You may be able to fix this with flutter ugprade --force or by following the instructions here:
https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#flutter-installation-corrupted
Run the following commands in the Flutter install directory:
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
change engine.version CRLF -> LF
for more info you can look at this
https://github.com/flutter/flutter/issues/35921

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.