是否可以为VSCODE扩展指定Flutter SDK路径



我的flutter sdk位于项目根目录中,因为我使用的是版本管理系统(FVM(。当我从控制台运行程序时,我会从控制台运行"fvm flutter run",但我也希望能够在项目根目录中使用该SDK启动调试会话。。。因此,我的问题是,是否可以指定在调试模式下启动Flutter应用程序的SDK路径,以及我该如何做?

在vscode中,按ctrl+shift+p,搜索"set flutter sdk",您也可以识别flutter安装和dart。您也可以在settings.json.中手动编辑

您可以尝试这样做,并创建一个launch.json,方法是转到VScode菜单中的Run,然后转到Add Configurations

请注意,添加以下项目的目录。

{
"configurations": [
{
"program": "lib/main.dart",
"name": "YOUR APP NAME",
"cwd": "/home/u/Projects/fireflutter/live-projects/YOUR_PROJECT_FOLDER/",
"type": "dart",
"request": "launch",
"flutterMode": "debug",
"args": [
// "--web-port",
// "8080",
// "--no-sound-null-safety",
// pass your arguments here, whatever you would type 
//in the terminal when you would use i.e 
//flutter run --no-sound-null-safety[I love null safety by the way, 
//but this is a common problem for people who still want to opt out of it.
],
}
],
"dart.flutterSdkPath": "/home/u/Downloads/sdks/flutter",
"dart.sdkPath": "/home/u/Downloads/sdks/flutter/bin/dart",
}

如果你得到一个错误,说Error: spawn /bin/sh ENOENT,这意味着你的路径不正确,你必须修复你的programcwdname。请更新结果。

相关内容

  • 没有找到相关文章

最新更新