使用VSCode和WSL2开发Flutter [英] Developing Flutter with VSCode and WSL2
问题描述
由于我主要使用nginx,PHP和MySQL开发Web,因此我已将WebDev环境完全移植到WSL2.由于性能非常重要,因此我所有与Web相关的项目都位于WSL2-vhdx文件/home/user/Projects/Web
中.在WSL2中,我安装了所有必要的工具,以提供良好而整洁的类似Linux的体验,例如Docker,GIT等.将其与VSCode远程集成结合使用非常好.
Since I mostly develop Web, using nginx, PHP and MySQL, I have ported my WebDev-environment entirely to WSL2.
Since performance is very important, all my web-related projects reside on the WSL2-vhdx file /home/user/Projects/Web
. In WSL2 I've installed all my necessary tools for a nice and neat Linux-like experience, Docker, GIT, etc.. This combined with VSCode remote integration works very well.
现在,我正在研究构建Flutter-Apps,并且将Flutter-environment安装在Windows端.我与Flutter相关的项目位于作为分区的 D:\ Projects \ Flutter
上,并且无论如何都位于WSL2中的未使用上.使用flutter-windows-sdk和VSCode构建Flutter-apps可以很好地工作.
Now, I'm digging into building Flutter-Apps, and my Flutter-environment is installed on the Windows side. My Flutter-related projects reside on D:\Projects\Flutter
which is a partition, and NOT USED in WSL2 in any way. Building Flutter-apps with flutter-windows-sdk and VSCode works neatly.
但是,问题是:现在,我的项目文件分散在我的计算机上.WSL2-vhdx文件中的Web内容和D分区上的Flutter-stuff.
But, the problem is: Now I've my project files scattered all across my computer. Web-stuff in a WSL2-vhdx-file and Flutter-stuff on the D-partition.
是否可以用Flutter构建flutter-app,同时将项目文件与VSCode-remote和Android模拟器结合存储在WSL2-vhdx文件中?
Is there a way to build flutter-apps with Flutter, while having the project-files stored on a WSL2-vhdx-file, in combination with VSCode-remote and an Android-emulator?
我尝试在 \\ wsl $
网络安装上创建一个测试Flutter-project,但这没有用.
I tried creating a test Flutter-project on the \\wsl$
network mount, which didn't work.
将与Web相关的项目文件移动到Windows的 D:\
分区是没有选择的,因为WSL2中的I/O安装非常慢.
Moving my web-related project files to the D:\
partition of Windows is no option, since the I/O mounts in WSL2 are extremely slow.
推荐答案
我可以使用 adb connect 192.168.xxx
可靠地运行它对于感兴趣的任何人,请在此处查看我的完整博客文章:
I got it working, reliably with adb connect 192.168.xxx
For anyone interested, see my full blog post here: https://dnmc.in/2021/01/25/setting-up-flutter-natively-with-wsl2-vs-code-hot-reload/
这篇关于使用VSCode和WSL2开发Flutter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!