You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Switch tasks from "dart pub run" and "flutter pub run" to "dart run", setting FLUTTER_ROOT if appropriate #5874
Is your feature request related to a problem? Please describe.
There is no immediate problem but is related to a deprecation. Since flutter pub run was deprecated in favor of dart run, the built in task command in the extension should be updated to use dart run.
Describe the solution you'd like
Update all following build tasks to use dart run instead
flutter: flutter pub run build_runner build
flutter: flutter pub run build_runner watch
flutter: flutter pub run build_runner serve
Describe alternatives you've considered
No other alternatives considered.
Additional context
Output from running flutter: flutter pub run build_runner build:
Since flutter pub run was deprecated in favor of dart run
Do you have any more info about this? I couldn't find anything about it (and I see very recent Flutter PRs changing from dart pub run to flutter pub run), but I found some comments in dart-lang/build#3665 (comment) from @jakemac53 saying:
On flutter projects you need to run using the flutter SDK, so flutter pub run build_runner build
(and that the warning may be a bug)
My guess is that the message "Deprecated. User dart run instead" is intended to mean "don't include pub in the command", however it's not correctly detecting that you ran via flutter and not dart.
So I think the correct fix here is to change flutter pub run ... to just flutter run .... @sigurdm I presume this message comes from pub - does this seem accurate?
The intended replacement is dart run. If you need the flutter sdk, use FLUTTER_ROOT/bin/dart run that should work.
Got it! From what SDK versions should we do this? (I failed to find anything in release notes for either SDK about when that became the preferred way, and I don't want to try and use it for older SDKs if it might not work).
Also - does this have to be the Dart wrapped script, and not dart from inside the nested SDK?
I ask, because Dart-Code never uses the dart wrapper script currently... shell scripts on Windows some issues (termination/signals not always being passed on) and generally any code written against dart we want to be the same for either SDK.
changed the title [-]Update tasks `flutter: flutter pub run build_runner` to use `dart run`[/-][+]Switch tasks from "dart pub run" and "flutter pub run" to "dart run", setting FLUTTER_ROOT if appropriate[/+]on Jan 20, 2026
@sigurdm thanks! We only support SDKs newer than that now, so don't need to handle falling back :)
@CaLouro I've changed this over. The changes are in the latest pre-release extension if you want to try them out now, otherwise they'll ship in a normal extension update probably at the end of this week or start of next week.
Activity
DanTup commentedon Jan 13, 2026
Do you have any more info about this? I couldn't find anything about it (and I see very recent Flutter PRs changing from
dart pub runtoflutter pub run), but I found some comments in dart-lang/build#3665 (comment) from @jakemac53 saying:(and that the warning may be a bug)
My guess is that the message "Deprecated. User
dart runinstead" is intended to mean "don't includepubin the command", however it's not correctly detecting that you ran viaflutterand notdart.So I think the correct fix here is to change
flutter pub run ...to justflutter run .... @sigurdm I presume this message comes from pub - does this seem accurate?sigurdm commentedon Jan 13, 2026
The message comes from pub.
pub runis deprecated. Both in the shape offlutter pub runanddart pub run.The intended replacement is
dart run. If you need the flutter sdk, useFLUTTER_ROOT/bin/dart runthat should work.sigurdm commentedon Jan 13, 2026
flutter runis intended for running a flutter app on a device, that is something completely different.DanTup commentedon Jan 13, 2026
Whoops, of course!
Got it! From what SDK versions should we do this? (I failed to find anything in release notes for either SDK about when that became the preferred way, and I don't want to try and use it for older SDKs if it might not work).
Thanks!
DanTup commentedon Jan 13, 2026
Also - does this have to be the Dart wrapped script, and not
dartfrom inside the nested SDK?I ask, because Dart-Code never uses the
dartwrapper script currently... shell scripts on Windows some issues (termination/signals not always being passed on) and generally any code written againstdartwe want to be the same for either SDK.sigurdm commentedon Jan 13, 2026
If the
FLUTTER_ROOTis set, it should workDanTup commentedon Jan 13, 2026
Great, thanks!
sigurdm commentedon Jan 13, 2026
Good question, I only have vague memories of when we did this - it seems to be https://dart-review.googlesource.com/c/sdk/+/168347 from 2020. I think that means from dart 2.12.0 and onwards.
sigurdm commentedon Jan 13, 2026
But any later version might be fine - as we have not removed
pub runyet.CaLouro commentedon Jan 17, 2026
Is there anything else that I can help you both with? You both seem to know much more than me at this point.
[-]Update tasks `flutter: flutter pub run build_runner` to use `dart run`[/-][+]Switch tasks from "dart pub run" and "flutter pub run" to "dart run", setting FLUTTER_ROOT if appropriate[/+]Switch "pub run" for "dart run" in tasks
Switch "pub run" for "dart run" in tasks
DanTup commentedon Jan 26, 2026
@sigurdm thanks! We only support SDKs newer than that now, so don't need to handle falling back :)
@CaLouro I've changed this over. The changes are in the latest pre-release extension if you want to try them out now, otherwise they'll ship in a normal extension update probably at the end of this week or start of next week.
Thanks!
CaLouro commentedon Jan 26, 2026
Thank you, @DanTup!