'Flutter packages get does not install new package
I'm trying to install a package (dynamic_theme) in flutter. When I run flutter packages get -v it does not even try to install the package.
So far I've tried:
- Running
flutter packages get - Running
flutter packages get - Restarting my computer
- Updated flutter
- Added another package but that did not install either
- Updated Android Studio
In my pubspec.yaml I've put:
dependencies:
flutter:
sdk: flutter
firebase_core:
cupertino_icons: ^0.1.2
dynamic_theme: ^1.0.1 # the package does not install
uuid: 2.0.0 # the package does not install
In the logs for the verbose run of flutter packages get where it installs the packages it outputs:
[ +422 ms] Running "flutter packages get" in quiz_app... (completed in 0.4s)
[ +57 ms] Found plugin firebase_core at E:\Other\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.3.4\
[ +13 ms] Found plugin shared_preferences at E:\Other\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.2\
[ +141 ms] Found plugin firebase_core at E:\Other\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.3.4\
[ +6 ms] Found plugin shared_preferences at E:\Other\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.2\
[ +26 ms] "flutter get" took 718ms.
I expected that flutter downloaded and installed the packages, but it does just check for updates on the already installed packages like firebase_core.
Solution 1:[1]
Close and open your editor. Worked for me ;)
Solution 2:[2]
so basically run:
flutter clean
flutter packages get
flutter packages upgrade
Restart Android Studio or Visual Studio
you can restart VSC by:
ctrl + shift + P and then a search bar will appear and then type: "restart" and smash the Enter key.
Solution 3:[3]
hi I have a similar problem I deleted a package from the dart packages folder and when I run flutter pub run it won't download and work so I tried all the way people said but something worked for me is I tried to repairing pub cache and it worked just run
flutter pub cache repair
Solution 4:[4]
I am currently experiencing this situation. When looking into it deeper, I've found that the packages never actually install themselves into the flutter packages folder.
The response I'm getting is exit code 0, with no error actual being reported.
When I put in my import 'package:english_words/english_words.dart';
it just shows up as a problem.
Solution 5:[5]
To install package you have to press double enter after the dependencies:
flutter:
sdk: flutter
carousel_pro: ^1.0.0
Then Package name e.g: carousel_pro: ^1.0.0.
Enter,spaces, and back spaces matter in pubspec.yaml File. I hope this resolve the issue.
Solution 6:[6]
Try to add ^ to uuid: 2.0.0
Good luck
// The last version is
uuid: ^2.0.1
Solution 7:[7]
in pubspec.yaml click Pub get it work for me
Solution 8:[8]
If you are using IntelliJ or Android Studio, do the following:
flutter clean
flutter packages get
and then click on File -> Invalidate Caches / Restart
After the IDE restarts chances are you may still face error but this time when you hover the code the import library tooltip will show
Solution 9:[9]
If you moved your project files from to a newly created project (probably because of AndroidX migration), check that your new pubspec.yaml is the same as the previous one or your code will blow up with package errors.
Solution 10:[10]
I had the same issue when I had my project in my google drive folder which has a space in the path. I moved it to the android studio folder and then pub get worked fine
Solution 11:[11]
I hit flutter pub get .
Though it ended with exit code 0 , i couldnt access my dependency lib classes via intellicense.
I restarted Android studio with Invalidate & Restart. That fixed the issue for me.
Solution 12:[12]
In Visual studio code, the thing that fixed it for me was
Command+Shift+P and then search "Dart: restart analysis server", in the pop up bar.
after the analysis was finished it worked like a charm.
Solution 13:[13]
If you delete a package from External Libraries > Dart Packages, you need to run -->
flutter pub cache repair
This will reinstall all the external libraries and update the missing ones. Get dependencies or Pub get and you are good to go!
Solution 14:[14]
Some quick fix for Android Studio :
- Check proper space before package name ( very much important )
- Click on Pub get or from terminal run command
flutter packages get, and you can download these dependencies, After successfully downloading the package, This warning is just here to reminds you that your dependencies aren't downloaded => Click onGet Dependenciesof the first warning
If you still getting error then follow below steps:
- Clean App : Android Studio > Tools > Flutter > Flutter Clean
- Restart Android Studio
Solution 15:[15]
After the update (23 September 2020) of Android Studio 4.1 the builtin terminal is not working for getting new packages.
Solution: Run the command prompt in Administrator mode. Go to your project directory and run command flutter clean after that run flutter pub get.
Solution 16:[16]
in my case nothing has happened after flutter upgrade, clean, pub get, etc. but when I restart my project it automatically gets pub Packages in VS code.
in a menu bar, Run => start debugging.
Solution 17:[17]
I fixed this issue by accepting Android Licenses using flutter doctor --android licenses. Note that you must install android SDK command-line tools to make this command work.
Steps:
- Install command-line tools via SDK manager
- Accept android licenses
- Run flutter pub get
Solution 18:[18]
If anyone of you is using Android Studio then Going to File->Invalidate Caches/Restart is your friend.
This is what has helped me, getting the updated dependencies for Android Studio.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
