Skip to content

Remove pub run #4737

Open
Open

Description

@sigurdm

dart pub run has been deprecated for years in favor of dart run.

The two commands have subtle differences in their command resolution and how they chose whether to recompile or not.

So we could choose to either

  • remove pub run
  • strictly align the two

Both might have a migration cost so I think the best choice might be to just rip off the bandage and remove it. I think an actual alignment would be very hard, because dart run can do a lot more than pub run.

We would now no longer have a way of running from a flutter invocation. Not sure if that is a problem. But in that case we could consider introducing a flutter dart or something.

cc @mit-mit are there anyone we should ask or warn?

Activity

  1. mit-mit commented on Jan 15, 2026

    @mit-mit
    Member

    Do we have any analytics on how used dart pub run in our most recent stable?

  2. sigurdm commented on Jan 16, 2026

    @sigurdm
    ContributorAuthor

    Numbers from last 30 days:

    dart run 13045847
    dart pub run 62390

    So certainly still being used, but not a lot...

  3. dcharkes commented on Jan 22, 2026

    @dcharkes
    Contributor

    I don't believe dart run works in a Flutter project with Flutter dependencies. IIRC the reason we have to do flutter pub run in some of these cases is because dart run will complain about there being flutter dependencies. This applies specifically for when you try to run one of your dev dependencies that in the package graph doesn't actually depend on a flutter package, but the way that the package resolution works is for your root package.

    Did we change dart run to support running dev deps that don't depend on Flutter while the root project or another dependency depends on the Flutter SDK? If not, I don't think we can remove flutter pub run just yet.

  4. sigurdm commented on Jan 22, 2026

    @sigurdm
    ContributorAuthor

    As long as you invoke with FLUTTER_ROOT/bin/dart or otherwise set your $FLUTTER_ROOT variable it should work.

  5. added a commit that references this issue on Feb 24, 2026
  6. FMorschel commented on Mar 27, 2026

    @FMorschel
    Old comment

    As long as you invoke with FLUTTER_ROOT/bin/dart

    @sigurdm, why is this? Is this hard-coded somewhere that we look up those folders to see if we are inside a Flutter SDK?

    I'm asking this because I want to understand how some puro commands are working (they use symlinks to share the same Dart SDK install across different Flutter patches - if they are the same version) and how I could help fix this.

    I'm wondering:

    • Say we have Dart at /foo/other/dart-sdk
    • And a Flutter SDK at /bar/flutter/
    • With /bar/flutter/bin/dart pointing to the first folder above

    If we ran from inside the Flutter SDK, would it still work? Or would we try to look up two folders from /foo/other/dart-sdk?

    I think I've figured it out. Even knowing this wouldn't help. I'm creating a PR to set the env var.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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