- Make sure you installed VS Code here: https://code.visualstudio.com/
- Open VS Code, find WSL from Extensions and install it
- Click on
Open a remote windows:
- Click on
Connect to WSL using Distro... By default, there is only Ubuntu (wsl1), you can use it if you want. But if you want to use WSL2, need to install another distro
4.1. List all available distros:
C:\WINDOWS\system32>wsl -l --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
4.2. Install the newer Ubuntu: Ubuntu-22.04
wsl --install -d Ubuntu-22.04
4.3. Check installed distros on your system
C:\WINDOWS\system32>wsl -l --all
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
Ubuntu-22.04
Once you have new distro version, go back VS Code and select Ubuntu-22.04. After logged in, you will see:
- Open Terminal from VS Code and interact with Ubuntu distro as usual (assume you are familier with Linux)
- Install Flutter for Ubuntu: https://docs.flutter.dev/get-started/install/linux
- Run Linux app
flutter create demo_flutter
cd demo_flutter
flutter run -d linux
You may hit error: /usr/bin/env: ‘bash\r’: no such file or directory when executing flutter CLI, to solve this:
sudo apt-get install dos2unix
find . -type f -exec dos2unix {} \;
Then restart WSL2 with wsl --shutdown
Done.


