Flutter and Windows Subsystem for Linux

6,840

Solution 1

I tried multiple ways to use flutter with WSL as there is no official way provided.

Restrictions I faced:

  1. Couldn't run the projects stored on WSL.
  2. 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 $@
}

Now you can use winpro to shift to windows and flutter will work as usual in WSL.

(Detailed: https://www.yashlamba.com/blogs/1/)

Solution 2

Flutter - Windows

Android Studio + Emulators - Windows

Execute on bash:

cmd.exe /c flutter run

ImageTerminal of VS Code executing the command "cmd.exe /c flutter run"

Solution 3

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.

Share:
6,840
Admin
Author by

Admin

Updated on December 01, 2022

Comments

  • Admin
    Admin over 1 year

    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?.