Dart pub get generates link to packages in each folder and subfolders

Issue

I try to avoid Dart to generate symbolic links (to packages) in each folder/sub-folder. For example, in pubspec.yaml I add polymer package and run pub get. After that I got:

enter image description here

Now each folder has packages symbolic link! As I understand it’s because to ensure that we can use package:.. statement in any Dart file in any subdirectory.

I’ve already read the following topic (Why is dart pub suddenly trying to install packages in my css folder?), but it was created 2 years ago. Maybe something new here? How can I specify folders to exclude generating links by pub?

Solution

These symlinks are necessary for many tools. You can use the experimental command line option --no-package-symlinks for pub get/pub upgrade to disable symlink creation. I tried this a while ago but the DartEditor debugger stopped working (see http://dartbug.com/21749).

There are plans to get rid of symlinks entirely. A proposal exists and I assume it will be implemented within a few months (no promises).

Update
No packages directory and no symlinks might become default with Dart 1.13.

Answered By – Günter Zöchbauer

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.