[
I have recently switched back from Ubuntu to Windows with Windows Subsystem for Linux using Ubuntu.
I want to get in touch with Flutter and would like to be able to use the bash for the Flutter-commands while developing on Windows.
Is that possible or should I just install everything for Windows?.
,
I tried multiple ways to use flutter with WSL as there is no official way provided.
Restrictions I faced:
- Couldn’t run the projects stored on WSL.
- Couldn’t use flutter commands on WSL when it was installed on windows.(Unlike some other tools)
I always prefer installing things on windows and running them on WSL. I just modified the commands a bit and now it works great. I added the following in my .bashrc
:
alias winpro='cd /mnt/<DIRECTORY IN WINDOWS YOU WANT>'
flutter() {
command CMD.exe /c flutter [email protected]
}
Now you can use winpro to shift to windows and flutter will work as usual in WSL.
(Detailed: https://www.yashlamba.com/blogs/1/)
,
,
You can create an alias like this in your .bashrc :
alias flutter='cmd.exe /c flutter'
then you should be able to use all your flutter commands directly from bash.
,
You can setup Flutter inside WSL and develop with VS Code Remote-WSL (on Windows) while having Dart Core extensions installed inside WSL
https://dnmc.in/2021/01/25/setting-up-flutter-natively-with-wsl2-vs-code-hot-reload/
]