我刚开始使用Flutter,在Android Studio中可以运行我的Flutter应用程序。我想尝试使用Visual Studio Code,但是当我点击运行按钮时,输出窗口中出现以下内容:
[Running] dart
"c:\MyStuff\Source\Flutter\hello_world\test\widget_test.dart"
'dart' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 0.199 seconds
我的第一个想法是我的Path环境变量,我已经因为尝试让它工作而搞砸了它。 它看起来像这样:
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps; c:\Flutter\bin;
c:\temp\flutter; c:\windows\system32;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\temp\Flutter\bin\cache\dart-sdk.old1\bin
我的 c:\temp\Flutter 目录看起来像这样:
https://istack.dev59.com/584fj.webp
我包含这个信息是因为我有点迷失,希望有人能发现我做错了什么。有人有任何想法我做错了什么吗?这似乎应该只是基本设置,但我显然搞砸了。 :(
编辑:
谢谢回复!我实际上是第一时间这样做的。Flutter doctor 给我的输出是这样的:
[flutter] flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version
10.0.16299.547], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK
28.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter
doctor --android-licenses
[√] Android Studio (version 3.1)
[!] VS Code, 64-bit edition (version 1.25.1)
[√] Connected devices (1 available)
! Doctor found issues in 2 categories.
exit code 0
我不知道如何在VSCode的命令面板中使用参数(-v)运行Flutter doctor。也许那样可以给我更多的信息。它似乎只允许我在那里运行“预设”命令。你知道我怎么能用-v参数运行Flutter doctor吗?
{ "workbench.colorTheme": "Visual Studio Light", "workbench.iconTheme": "material-icon-theme", "dart.flutterSdkPath": "C:\\temp\\Flutter\\bin" }
我的路径现在看起来像这样:%USERPROFILE%\AppData\Local\Microsoft\WindowsApps; c:\temp\flutter; c:\windows\system32;但我仍然得到相同的错误... "'dart' 不是内部或外部命令" - John