When I run in terminal flutter pub get is stuck it's showing
OS MacOS Catalina 10.15.3
Got TLS error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Got socket error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...
Got TLS error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 3 in 4 seconds...
Got socket error trying to find package launch_review at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 4 in 8 seconds...
Got socket error trying to find package launch_review at https://pub.dartlang.org.
Quick fixes before explanation:
Restart your router! Works for me several times.
Make sure your network is not behind a proxy
Make sure you can ping to pub.dev without any packet loss
Try to close all of your dart.exe processes before retying to perform the flutter pub get
Try to delete an existing package from your pubspec.yaml and re-get it to see if it works
Try to manually add the package to your project
So, I had (and sometime still having) the same issue. I've analyzed it and came to a conclusion that the package download manager and the server that hosts those packages aren't reliabe at all. Very small packages might just successfully be imported with "flutter pub get", whereas big ones might last forever to download. This is definately a networking issue, on either yours or their side.
Just for verificatioin that we are indeed experiencing the same issue:
open your cmd (no matter t OS) and run: ping -t pub.dev .Now, if you see those inconsitent replies from the server, it means there's something wrong with the network (yours or their side). This looks something like this:
Open up your task manager and look for the latest dart.exe task (it should be invoked the moment you flutter pub get. This task is the package that is being downloaded. If you see the process size never exceeding a certain size, and the get command is still stuck, it only indicates a network issue and the package might never be downloaded successfully. For example, my attempts to get the carousela_flutter 1.4.1 package ended up with a halted process size of around 60mb, looks this this:
If you wait for a relatively large amount of time (10 minutes I would say is enough) and the connectivity issue is still not resolved, you will see the following msg from flutter:
"Process finished with exit code 0".
I suggest you try another time or maually add the package.
p.s: it doesn't happen with all of the packages and from my investigation is seems to be related to the size of it. e.g, I managed to get the carousela_flutter 0.7.0 package, but the 1.4.1 failed.
In my case, The host of my ISP was blocked so it could not get the package and it was showing pub get failed (server unavailable) -- attempting retry 1 in 1 second...
So I turn on my VPN and tried once again and this time it was a success
If its a git error, use this command:
git config --global url."https://".insteadOf git://
More info here
502 Bad Gateway trying to find package package_name at https://pub.dartlang.org.
If you click on the link, you'll find that the website is down. The same is also applied to https://pub.dev/.
I´ve solved it on my Windows machine.
After many tries from answers in many discussions out there, I tried a lot of stuff, like:
Restarting the machine
Deleting the cache folder (the dart-sdk download may be restarted)
Adding dart-sdk in the Environment Variable Path
X:\Dev\Flutter\bin\cache\dart-sdk\
Adding dart-sdk´s bin folder in the Path variable (for both Environment and User Variables) (desperate action, I know)
X:\Dev\Flutter\bin\cache\dart-sdk\bin
And still didn´t work.
BUT... I´ve found on this thread something about a proxy problem.
Then I´ve decided to try it out on my Windows machine, and it worked (finally).
Try typing this on Power Shell:
$Env:https_proxy="your.proxy.here:8080"
Then try flutter doctor again
hmm, i know how frustrating it can be trying to solve the issue, the best solution to this is to use vpn and connect to another server. this way i was able to solve the problem without stress
As said it might be something that has to do with your network....
Disconnecting and reconnecting fixed mine.
Make sure no firewall is blocking it.
Check for Internet connectivity too. Search your browser, don't rely on the windows wifi symbol.
For me, KIS (Kaspersky) was blocking pub.bat.
If that is the case please also check---- Flutter, dart, android studio, Gradlew.bat, sdkmanager.bat, adb.exe, qemu-systems, emulator-check and google for any blockage. (just search in firewall settings).
In my case it was my virus program (AVG AntiVirus' Web Shield) that suddenly caused pub get to fail.
Because restaurant depends on flutter any from sdk which doesn't exist (unknown SDK "flutter"), version solving failed
fix proplem
done
change this package
this path prev last
path_provider_windows:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/lib/
change path fluatter plus /all
path
path_provider_windows:file:///C:/all/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.5/lib/
its ok
thanks
I was able to resolve it by using Visual Studio Debuggable Package Manager PowerShell, on your system open visual studio debuggable package manager and then type in flutter doctor it will resolve it within seconds
make sure there is no typo in pubpspec.yaml check it on here https://stackoverflow.com/a/72198419/8122500
I have been having issues with installing this package https://pub.dev/packages/graphql_flutter/install one of it's dependencies is this graphql package https://pub.dev/packages/graphql. When i do pub get it installs en shows everything expect for the graphql package in the dart packages folders. I have tried to install the graphql package separately but the package still doesnt show up than. And the import still gives the error "Target of URI doesn't exist: 'package:graphql/client.dart'." But it does show up in flutter/.pub-cache/hosted/pub.dartlang.org so i dont understand why it doesnt show in my project. I have tried using flutter clean, flutter clean pub cache and androidstudio's invalidate caches/restart function to no avail. I have also tried restarting android studio and my pc multiple times. I have also tried it with androidstudio run as admin.
This is my pubspec.yaml
this is part of my Dart packages folder as you can see it does not show
And this is the pub.dartlang.org folder on my pc
It ended up getting randomly fixed after 3 days. I just started android studio up and tried it again and suddenly it worked. No idea what fixed it in the end
Seen this issue a few times. Open Task manager in windows and check for adb.exe. There should be one copy running. I had 2 copies so removed 1 and restarted the other.
right-click --> end task for both.
All ok then.
Reloading VS code worked for me..
Reloading can be done ---> Command + R for Mac.
When running a new application "flutter pub get" in Vscode keeps running without completion.I have tried flutter clean , and reopening vscode.
I think you have to check the proper package name. Maybe you misspelled the package name or else your internet is not working fine.
I was facing same issue, I checked all package names, they were correct. I did run flutter clean and then flutter pub get and it's worked. Hope! this might be helpful if some one faces same issue as I was.
Try flutter clean command, also remove pubspec.lock file in root directory then re-run this command flutter pub get.
Actually it would be the issue related to the network rules in your system. means issue is related to IT team. they will unblock your firewall or use network proxy to fix this issue.
While my normal internet connection took more than 15 minutes, I connected to vpn from a different country and tried flutter pub get. It worked pretty fast.
I got the same issue and I resolved it by synchronizing date and hours of my computer.
With an incorrect date, you can have some network issues.
(My computer's date was set to 'yesterday')
On Linux, this worked for me and for many other people...
It should work for you too.
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
On windows, you should create an environment variable with:
name: PUB_HOSTED_URL
value: https://pub.flutter-io.cn
name: FLUTTER_STORAGE_BASE_URL
value: https://storage.flutter-io.cn
#Code gotten from MathiasGodwin on Grepper
Step 1: flutter clean
step 2: remove pubspec.lock
step 3: If your project has lots of dependencies then load 1 or 2 at once .
It can happen because of lots of dependencies and slow internet connection.
I disconnected from the VPN and it worked for me.
I can't use anymore flutter clean or doctor in command line in Android Studio 3.6.1.
When I try I have this message :
Downloading windows-x64/font-subset tools...
Download failed.
URL: https://storage.googleapis.com/flutter_infra/flutter/e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/windows-x64/font-subset.zip
Error: 404 Not Found
I try to use gradlew clean. I had exactly the same message.
By the way flutter structure is empty when I open a flutter file and I don't have any completion or shortcut to go to functions (message: cannot find declaration to go to).
Do you have any clue to why it's happen and how to fix it?
Thanks
I found a solution.
I remove flutter.
I reinstall it and it's worked now.
If someone now why that's happen I am interested.
That's happened for some network issue, your network can not access the server.
More Details: https://github.com/flutter/flutter/issues/48030
Hope you will find your all answers and solutions.
Cloned from github a flutter repo onto Laptop(win10) and Desktop (win7) but on Desktop package get fail with error code 1
First two images show success on laptop pc.
See Below Desktop Fails to get packages.
Where should I correct this on Desktop?
However, I can create new app without any error on Desktop.
Please help, Thank you.
I deleted the two log files and also pubspec.lock file and run Flutter Get Packages. This Resolved the issue. This agonizing error ate up few hours.
I tried
flutter clean
flutter packages get
it worked