Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to remove installed packages that no longer needed? #24733

Closed
gueano opened this issue Nov 26, 2018 · 3 comments
Closed

how to remove installed packages that no longer needed? #24733

gueano opened this issue Nov 26, 2018 · 3 comments

Comments

@gueano
Copy link

gueano commented Nov 26, 2018

for example, I just installed the "http" package with:

  1. add "http: ^0.12.0" to the secion dependencies in the file pubspec.yaml
  2. run command "flutter packages get"

That's great, super easy.

but what if I don't need it anymore? I want to remove it from my project. following is what I have done.

  1. I have removed what I added to the file pubspec.yaml
  2. run command "flutter packages get" again
  3. build project

but the http package is still available in my code. What else I need to do, please?

@zoechi
Copy link
Contributor

zoechi commented Nov 26, 2018

Packages you add to pubspec.yaml are downloaded to
~/.pub-cache/... per version and shared between all your projects.
If a package is from pub.dartlang.org it will be stored in
~/.pub-cache/hosted/pub.dartlang.org/
(if PUB_CACHE is set $PUB_CACHE/hosted/pub.dartlang.org/ would be used instead)

If you remove a package from pubspec.yaml but another dependency depends on it, the package will still be listed in pubspec.lock and therefore will be available in your project.
You should get an error if your custom code imports a package that is not listed in dependencies: in pubspec.yaml, but otherwise this doesn't result in a warning.

You can investigate transitive dependencies using flutter packages pub deps

You can delete packages from ~/.pub-cache/... (or the whole ~/.pub-cache/hosted/pub.dartlang.org/ directory) to clean up the cache. You would need to run flutter packages get in your active projects to get the required dependencies downloaded again.

Please consider asking support questions in one of the other channels listed at http://flutter.io/support .

@doanbh
Copy link

doanbh commented Mar 9, 2020

It took me more than 3 days to try all differently way. But finally I found, you need to go into the "pubspec.lock" file. Then go to the library and change the version there. Then go back to the file "pubspec.yaml" and run Packages get and it succeeds.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants