Skip to content

Support URLs and paths in Add Dependency command #3635

@EhsanAramide

Description

@EhsanAramide

I am using v3.27.2 of the extension and I searched for a similar issue but I didn't find anything related.

Currently, the auto-completion about dependencies just works in pubspec.yaml but I think it can be better to add the dependencies in import (for tired guys can be the best solution).

At this time the process for using a package is: (expect its kind - local, hosted on pub server or as a dev dep)

  1. Adding dependencies in pubspec.yaml
  2. Runnin pub get to fetch the package and other related configs
  3. import it and use it

But I suggest a new way (I am not sure this feature can be implemented in extension or not let me know).
For example, we want to add a dependency in the dependency section in pubspec.yaml what we should do is:

  1. import the package with this syntax import 'dep:<package_name | git_remote_repo | local/path/to/package>'; auto completion works as same logic as used in pubspec.yaml (with some modification)
  2. crtl + . click on fetch package
  3. then pub add <package_name> --<associated_switch> will run and do all configurations

Note: as dev dependency we can use import 'dev:<package_name | git_remote_repo | local/path/to/package>';

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue :octocat:A relatively straight forward issue that could be done by a new contributorin commandsRelates to commands (usually invoked from the command Palette)is enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions