Skip to content

Support space separators in Dart: Add Dependency instead of only commas #5665

Closed

Description

@FMorschel

Describe the bug
Adding dependencies resulted in a bug.

To Reproduce
Steps to reproduce the behavior:
Select Dart: Add Dependency and write get_it watch (select watch_it)
See:

[qr_code] flutter pub add get_it watch_it
Not a valid package name: "null"

Usage: dart pub add [options] [<section>:]<package>[:descriptor]
       [<section>:]<package2>[:descriptor] ...]
-h, --help               Print this usage information.
    --[no-]offline       Use cached packages instead of accessing the network.
-n, --dry-run            Report what dependencies would change but don't change
                         any.
    --[no-]precompile    Build executables in immediate dependencies.
-C, --directory=<dir>    Run this in the directory <dir>.

Run "dart help" to see global options.
See https://dart.dev/tools/pub/cmd/pub-add for detailed documentation.
Failed to update packages.
exit code 64

Expected behavior
For the option to add multiple packages to work.

Repro:

https://github.com/FMorschel/qr_code

Please complete the following information:

Workspace Environment
Dart Code extension: 3.117.20250813
Flutter extension: 3.117.20250731 (activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.103.2

Workspace type: Flutter (LSP)
Workspace name: qr_code

Dart (3.9.0): C:\Users\felip_0vh5fa6\.puro\shared\caches\1e9a811bf8e70466596bcf0ea3a8b5adb5f17f7f\dart-sdk
Flutter (3.35.1): C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter (Windows (windows-x64/windows))

Output from 'dart info'

C:\Users\felip_0vh5fa6\.puro\shared\caches\1e9a811bf8e70466596bcf0ea3a8b5adb5f17f7f\dart-sdk\bin\dart.exe info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.9.0 (stable) (Mon Aug 11 07:58:10 2025 -0700) on "windows_x64"
  • on windows / "Windows 11 Pro" 10.0 (Build 26100)
  • locale is pt-BR

Project info

  • sdk constraint: '^3.9.0'
  • dependencies: file_picker, flutter, flutter_colorpicker, image_picker, path_provider, pretty_qr_code
  • dev_dependencies: flutter_lints, flutter_test

Process info

Memory CPU Elapsed time Command line
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
Output from 'flutter doctor'

C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter\bin\flutter.bat doctor -v

[!] Flutter (Channel stable, 3.35.1, on Microsoft Windows [Version 10.0.26100.4946], locale pt-BR) [1.714ms]
    • Flutter version 3.35.1 on channel stable at C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter
    ! Warning: `flutter` on your path resolves to C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter\bin\flutter, which is not inside your current Flutter SDK checkout at C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter. Consider adding C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter\bin to the front of your path.
    ! Warning: `dart` on your path resolves to C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter\bin\dart, which is not inside your current Flutter SDK checkout at C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter. Consider adding C:\Users\felip_0vh5fa6\.puro\envs\latest\flutter\bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (11 days ago), 2025-08-14 10:53:09 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Windows Version (11 Pro 64-bit, 24H2, 2009) [10,6s]

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [8,7s]
    • Android SDK at C:\Users\felip_0vh5fa6\AppData\Local\Android\sdk
    • Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: C:\Users\felip_0vh5fa6\AppData\Local\Programs\Android Studio 2\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
    • All Android licenses accepted.

[✓] Chrome - develop for the web [632ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.5) [626ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.12.35728.132
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2024.3.2) [323ms]
    • Android Studio at C:\Users\felip_0vh5fa6\AppData\Local\Programs\Android Studio 2
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)

[✓] IntelliJ IDEA Community Edition (version 2025.1) [319ms]
    • IntelliJ at C:\Users\felip_0vh5fa6\AppData\Local\Programs\IntelliJ IDEA Community Edition 2
    • Flutter plugin version 86.0.2
    • Dart plugin version 251.25410.28

[✓] VS Code (version 1.103.2) [21ms]
    • VS Code at C:\Users\felip_0vh5fa6\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.117.20250731

[✓] VS Code, 64-bit edition (version 1.100.0-insider) [20ms]
    • VS Code at C:\Program Files\Microsoft VS Code Insiders
    • Flutter extension version 3.108.0

[✓] Connected device (4 available) [1.584ms]
    • SM G780F (mobile) • dev-phone:46621 • android-arm64  • Android 13 (API 33)
    • Windows (desktop) • windows         • windows-x64    • Microsoft Windows [Version 10.0.26100.4946]
    • Chrome (web)      • chrome          • web-javascript • Google Chrome 139.0.7258.127
    • Edge (web)        • edge            • web-javascript • Microsoft Edge 138.0.3351.121

[✓] Network resources [1.195ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. changed the title [-]`Dart: Add Dependency` not working[/-] [+]`Dart: Add Dependency` not working for multiple packages[/+] on Aug 25, 2025
  2. FMorschel commented on Aug 25, 2025

    @FMorschel
    ContributorAuthor

    Note that adding both, one at a time, does work.

  3. DanTup commented on Aug 26, 2025

    @DanTup
    Member

    This was written assuming you'd use commas, not spaces. However, I don't think there's a reason we shouldn't just support both so I'll look at that.

  4. changed the title [-]`Dart: Add Dependency` not working for multiple packages[/-] [+]Support space separators in `Dart: Add Dependency` instead of only commas[/+] on Aug 26, 2025
  5. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in commandsRelates to commands (usually invoked from the command Palette)
    and removed on Aug 26, 2025
  6. added this to the v3.118.0 milestone on Aug 26, 2025
  7. FMorschel commented on Aug 26, 2025

    @FMorschel
    ContributorAuthor

    Ohh, I see. I was using spaces since the completion happens and the cli does support it.

  8. DanTup commented on Aug 26, 2025

    @DanTup
    Member

    You're right - while looking at the code I realise we support spaces for the completion to handle where you put a space after the comma foo, bar, so it half-worked accidentally. I'll fix the other part :-)

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

    in commandsRelates to commands (usually invoked from the command Palette)is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions