aman singh
aman singh

Reputation: 83

Flutter pub get takes too long to execute

When running a new application "flutter pub get" in Vscode keeps running without completion.I have tried flutter clean , and reopening vscode.

Upvotes: 8

Views: 17511

Answers (12)

Yaseen Yaseen
Yaseen Yaseen

Reputation: 1

Add Flutter to your firewall rules (System Settings/Network/Firewall/Options...) by enabling incoming connections, it's not perfect but it works for me (I'm on MacOS Sequoia).

Upvotes: 0

just use different internet, for my case, i used my phone's data mobile hotpost to fix it.

Upvotes: 0

Ahmad hassan
Ahmad hassan

Reputation: 1019

Try flutter clean command, remove pubspec.lock file in root directory then re-run flutter pub get.

Upvotes: 14

Victor Anawo
Victor Anawo

Reputation: 11

Changing the pub endpoint to China's one

for some reason, the default endpoint takes too much time to respond so changing the pub. dev endpoint might help

On Linux or Mac OSX, this worked for me and many other people...

edit ~/.bashrc or ~/.zshrc based on your shell

export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"

run source ~/.bashrc or source ~/.zshrc to apply the changes to the current terminal window.

On Windows, you should create an environment variable with the following:

name value
PUB_HOSTED_URL https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn

Code got from MathiasGodwin on Grepper

Upvotes: 0

Cihan Kalmaz
Cihan Kalmaz

Reputation: 959

I connected via VPN. And run flutter pub get. It fixed my issue.

Upvotes: 0

surya
surya

Reputation: 97

I disconnected from the VPN and it worked for me.

Upvotes: 0

amarjeet kushwaha
amarjeet kushwaha

Reputation: 11

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.

Upvotes: 1

Y. Tarion
Y. Tarion

Reputation: 423

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')

Upvotes: 0

Vignesh Sekar
Vignesh Sekar

Reputation: 66

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.

Upvotes: 0

Nik
Nik

Reputation: 2060

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.

Upvotes: 4

vinay pratap singh
vinay pratap singh

Reputation: 1

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.

Upvotes: 0

Balram Rathore
Balram Rathore

Reputation: 76

I think you have to check the proper package name. Maybe you misspelled the package name or else your internet is not working fine.

Upvotes: 5

Related Questions