Reputation: 740
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:
flutter packages get
flutter packages get
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.
Upvotes: 39
Views: 113904
Reputation: 180
This worked for me:
Upvotes: 1
Reputation: 463
in
pubspec.yml
be sure you add your packages underdependencies
notdev_dependencies
Upvotes: 1
Reputation: 1630
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.
Upvotes: 3
Reputation: 361
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!
Upvotes: 4
Reputation: 101
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.
Upvotes: 7
Reputation: 581
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:
Upvotes: 1
Reputation: 86
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.
Upvotes: 2
Reputation: 55
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
Upvotes: 2
Reputation: 580
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.
Upvotes: 48
Reputation: 7716
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.
Upvotes: 1
Reputation: 795
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
Upvotes: 24
Reputation: 331
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.
Upvotes: 0
Reputation: 126
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
.
Upvotes: 0
Reputation: 438
Some quick fix for Android Studio :
- Check proper space before package name ( very much important )
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 on Get Dependencies
of the first warningIf you still getting error then follow below steps:
Upvotes: 0
Reputation: 515
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
Upvotes: 1
Reputation: 123
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.
Upvotes: 6
Reputation: 91
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.
Upvotes: 9
Reputation: 740
Something solved it randomly. I did not do anything but try multiple times. After some 10 attempts it downloaded and installed both uuid and dynamic_theme.
Upvotes: 2
Reputation: 628
Try to add ^ to uuid: 2.0.0
Good luck
// The last version is
uuid: ^2.0.1
Upvotes: 1