Skip to content

Support --no-pub flag on pub remove (and potentially other subcommands) #4681

@foxanna

Description

@foxanna

It would be fantastic to have a way to run dart pub remove without calling dart pub get. For example, with --no-pub flag:

dart pub remove http --no-pub

Reason for request

In our huge fin-tech mobile application, we have to have a lot of dependencies on native libraries of 3rd-party providers. We build multiple products from the same codebase, and those native dependencies do not always have to be included in a particular product. But they are not being tree-shaken by default, even if the entry point code does not hit the code path that makes calls to those libraries.

To work around this, we wrap every such dependency in a dedicated dart package wrapper. And, in case such a dependency should not be included, we run

dart pub remove <wrapper_package_name>

before building a mobile app for a certain product.

Given the scale of our application, we have on average 10 packages on which we have to call pub remove. This in turn leads to 10 extra dart pub get calls, which, on constraint environments like CI, takes about 1 minute each.

Being able to turn dart pub get call off with --no-pub, and then only running one dart pub get after all unwanted dependencies are removed, would allow us saving ~10 minutes with each build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions