Krunal
Krunal

Reputation: 79776

Flutter: 'package get' has not been run; 'Pub get' has not been run

I dowloaded a Flutter sample code for Catalog from git, which showing me a warning,

'package get' has not been run
'Pub get' has not been run

What does it mean? How to solve it? Should I ignore this warnings or Update dependencies as suggested with links in warning?

enter image description here

Upvotes: 15

Views: 53511

Answers (17)

Saeed Azarmehr
Saeed Azarmehr

Reputation: 9

This error is uccered when your flutter sdk and dart sdk werent matched, so by disabling both plugins in android studio and enable only the flutter plugin, this problem will be solved.

Upvotes: 0

Mostafa Mohamed
Mostafa Mohamed

Reputation: 41

when clicks on Get Dependencies but doesn't work. All you need to do is:-

1- Go to pubspec.yaml

2- click a Pub get

in the toolbar

3- congratulations! done does work now :D

Upvotes: 2

Hossein Yousefpour
Hossein Yousefpour

Reputation: 4973

For me, it was happening on the local packages in my project, and clicking on Get dependencies was not working.

The reason is that Get dependencies on the banner runs the flutter pub get on the main root of the project, not that specific package. So the fix would be:

  1. Open the Terminal and navigate to each package directory (where you can find the pubspec.yaml for that package) using cd package_name
  2. Run flutter pub get
  3. Do it for all your local packages

Upvotes: 1

Ant T
Ant T

Reputation: 11

Try setting your Dart entrypoint. Go to File -> Run -> Profile -> Edit Configurations -> New configuration (+ on the top left) -> Flutter and set the Dart entrypoint to your main.dart file. For example:

AndroidStudioProjects/project_foo/lib/main.dart

Then set a device and run the project. The dependencies should resolve automatically.

Upvotes: 1

Shoaib Ali
Shoaib Ali

Reputation: 11

if nothing works even after clicking on Get Dependencies and restarting update your android studio IDE that will work

Upvotes: 1

Stinni
Stinni

Reputation: 11

Update your plugins/externals by restarting android studio. It asked for that and then it all worked.

Upvotes: 1

无夜之星辰
无夜之星辰

Reputation: 6178

I tried all solution in this post but nothing help even reopen IDE. Finally I have no choice but click the Ignore button:

enter image description here

This is the last way... Maybe it's a bug of IDE.

So take it easy and just click Ignore button when you had execute pub get.

Note: My projects all work well.

Upvotes: 1

Blue Phoenix
Blue Phoenix

Reputation: 151

enter image description hereWhen I face that error, actually I found out that I am in another subfolder. The solution is really easy to delete an extra folder or just cd that subfolder and run "flutter pub get" command. ... Sorry for my bad English!

Upvotes: 1

Duy An Minh Pham
Duy An Minh Pham

Reputation: 51

This is for anyone who clicks on Get Dependencies but doesn't work. All you need to do is:

Step 1: Go to terminal and type flutter upgrade

Step 2: Go to File -> Invalidate Caches/Restart -> click Restart

Step 3: Now just click Get Dependencies

That will do the job.

Upvotes: 2

This is the correct way i am try it , It works normally

To solve this error in the EASIEST WAY follow below steps :

  1. Go to terminal

  2. Then find local tabs

  3. Then click on a '+' sign and type your command.This should solve your error

Upvotes: -1

Fars Fuad
Fars Fuad

Reputation: 21

  1. Click Get dependencies and wait for it to finish.
  2. Restart Android Studio

Upvotes: 2

simplygk
simplygk

Reputation: 101

Just restart Android Studio or Your IDE, it worked for me also. Or Run flutter upgrade in terminal.

Upvotes: 8

Damitha Neranjan
Damitha Neranjan

Reputation: 21

Click on the 'Get dependencies' on the banner 'pub get', then the banner will disappear an the dependencies will get downloaded and the errors will disappear. If still the errors remain then restart Android Studio and try. It worked for me.

Upvotes: 1

Henry Ning
Henry Ning

Reputation: 111

The banner 'Pub get' has not been run did not disappear even after I clicked Get dependencies and Upgrade dependencies.

Then, after I closed Android Studio and opened the same project again, the banner disappeared.

Upvotes: 11

vinaytejab
vinaytejab

Reputation: 61

Reopen the project if the error does not disappear even after downloading dependences.

Upvotes: 2

EVEREST ACADEMY
EVEREST ACADEMY

Reputation: 17

Just open the Terminal and run :

flutter upgrade

Upvotes: 0

Rémi Rousselet
Rémi Rousselet

Reputation: 277627

Dart is similar to node. It has a pubspec.yaml which is the equivalent of package.json containing your dependencies and stuff.

And you need to download these dependencies, using pub get. Or on the case of flutter, using flutter packages get.

This warning is just here to reminds you that your dependencies aren't downloaded

=> Click on Get Dependencies of the first warning

Upvotes: 23

Related Questions