@@ -135,16 +135,6 @@ FLUTTER_ROOT environment variable."
135135 file-truename)
136136 (getenv " FLUTTER_ROOT" )))
137137
138- (defun lsp-dart-pub-command ()
139- " Return the pub executable path from Dart SDK path."
140- (if (eq system-type 'windows-nt )
141- (expand-file-name " bin/pub.bat" (lsp-dart-get-sdk-dir)))
142- (expand-file-name " bin/pub" (lsp-dart-get-sdk-dir)))
143-
144- (defun lsp-dart-pub-snapshot-command ()
145- " Return the pub snapshot executable path from Dart SDK path."
146- (expand-file-name " bin/snapshots/pub.dart.snapshot" (lsp-dart-get-sdk-dir)))
147-
148138(defun lsp-dart-dart-command ()
149139 " Return the dart executable from Dart SDK dir."
150140 (let* ((executable-path (if (eq system-type 'windows-nt ) " bin/dart.bat" " bin/dart" ))
@@ -153,14 +143,26 @@ FLUTTER_ROOT environment variable."
153143 command
154144 (lsp-dart-log " Dart command not found in path '%s'" command))))
155145
146+ (defun lsp-dart-pub-command ()
147+ " Return the pub executable path from Dart SDK path."
148+ (if (lsp-dart-version-at-least-p " 2.16.0" )
149+ (list (lsp-dart-dart-command) " pub" )
150+ (if (eq system-type 'windows-nt )
151+ (list (expand-file-name " bin/pub.bat" (lsp-dart-get-sdk-dir)))
152+ (list (expand-file-name " bin/pub" (lsp-dart-get-sdk-dir))))))
153+
154+ (defun lsp-dart-pub-snapshot-command ()
155+ " Return the pub snapshot executable path from Dart SDK path."
156+ (expand-file-name " bin/snapshots/pub.dart.snapshot" (lsp-dart-get-sdk-dir)))
157+
156158(defun lsp-dart-flutter-command ()
157159 " Return the flutter executable from Flutter SDK dir."
158160 (let* ((executable-path (if (eq system-type 'windows-nt )
159161 " bin/flutter.bat"
160162 (concat " bin/" lsp-dart-flutter-executable)))
161163 (command (expand-file-name executable-path (lsp-dart-get-flutter-sdk-dir))))
162164 (if (file-exists-p command)
163- command
165+ ( list command)
164166 (lsp-dart-log " Flutter command not found in path '%s'" command))))
165167
166168
@@ -229,7 +231,7 @@ FLUTTER_ROOT environment variable."
229231
230232(defun lsp-dart-get-full-flutter-version ()
231233 " Retrieve the Flutter version from shell command."
232- (->> (concat (lsp-dart-flutter-command) " --version" )
234+ (->> (concat (string-join ( lsp-dart-flutter-command) " " ) " --version" )
233235 shell-command-to-string))
234236
235237(defun lsp-dart-get-dart-version ()
0 commit comments