In javascript, we have NPM and the node_modules
folder in every project. I was not able to find a similar concept for Dart/ Flutter, except the build
folder in my app, which contains a folder of a few dependencies I have in pubspec.yaml
. It doesn't have any of the source code though, and I think it's actually built from something else. I've also looked in /usr/local/flutter/packages
which is where my flutter is installed, but it only shows flutter_driver
, flutter_goldens
, and more seemingly unrelated folders.
I guess if wanted to read the source code, I really need to find the repo and read from that, or is there a location for dependencies I haven't looked?
I even found projectDir/.dart_tool/pub
, which didn't have any of my packages.
By default, the system package cache is located in the . pub-cache subdirectory of your home directory (on macOS and Linux), or in %LOCALAPPDATA%\Pub\Cache (on Windows; the location might vary depending on the Windows version).
yaml file, often referred to as the pubspec. A basic pubspec is generated when you create a new Flutter project. It's located at the top of the project tree and contains metadata about the project that the Dart and Flutter tooling needs to know.
Every pub package needs some metadata so it can specify its dependencies. Pub packages that are shared with others also need to provide some other information so users can discover them. All of this metadata goes in the package's pubspec: a file named pubspec. yaml that's written in the YAML language.
I could directly view the source code of the package under `
[External Libraries/Dart Packages/Your Packages]
`
You can get pubspec downloaded from your flutter sdk location .
/flutter/.pub-cache/hosted/pub.dartlang.org/
You can also clone package git .
From the documentation:
Dependencies downloaded over the internet, such as those from Git and the pub.dev site, are stored in a system-wide cache. This means that if multiple packages use the same version of the same dependency, it only needs to be downloaded and stored locally once.
By default, the system package cache is located in the
.pub-cache
subdirectory of your home directory (on Mac and Linux), or in%APPDATA%\Pub\Cache
(on Windows; the location might vary depending on the Windows version). You can configure the location of the cache by setting thePUB_CACHE
environment variable before running pub.
So for Mac and Linux for example, this would be ~/.pub-cache/hosted/pub.dartlang.org
by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With