Flutter for Windows [Device]
In this article we are going to see, how can we build (run) a flutter app for the Windows platform. Yes! you heard it right, we will build a flutter app for windows.
A few examples of better windows apps were featured in an article by Chris Sells(Please find the link for the article at the bottom).
Note: I haven’t tried running flutter for windows on macOS.
So, let’s get started with configuring the windows machine.
1. Configure windows machine
Few things you need before starting.
- Flutter SDK on windows
Now, we are good to go.
A. Change flutter SDK to dev channel by following command in CMD
$ flutter channel dev
B. Upgrade flutter SDK by the following command in CMD
$ flutter upgrade
C. Enable flutter SDK capability to consider windows as a build platform too (like android, iOS)
$ flutter config --enable-windows-desktop
Now, that our machine is ready with flutter SDK. We will install other required dependencies to run the windows app.
Run the following code in CMD to check what others are left to install
$ flutter doctor
You would see the missing message for ‘ Visual Studio’
Download it from here https://visualstudio.microsoft.com/downloads/, and follow instructions to install ‘Visual Studio Community 2019’.
Once done, run $ flutter doctor again. You should be seeing something like this. If you see missing Visual Studio, then your installation is incomplete.
Note: VS Code is just an editor. For windows development you need Visual Code.
Now run the following code to see if you are getting windows as a device to run flutter code.
$ flutter devices
You should be getting the following result. If you see windows as a device then you are good to go
Now that our machine is configured, let’s try to create(or use an existing) project to run for windows devices.
2. Create / Update flutter project
A. If you want to try in the existing project then run the following code in your project’s CMD.
$ flutter create .
It will create a windows folder in your flutter project.
B. If you want to try by creating a new flutter project then run the following code. Replace with your project name. I’ll use
$ flutter create new_windows_project
Your folder structure should look like this.
Now, let’s try to run our project. I’ve created a new empty flutter project with a counter application template. The following code will run the flutter project for windows device
$ flutter run -d windows
The above image is a snapshot of our windows application.
That is it! I feel awesome to see my application running on the windows machine. Now our flutter project will be seen running on macOS, Linux, Windows, Android, iOS, Web platforms.
I will post a more detailed explanatory video on our YouTube channel.
I hope you liked this article!
Connect me on twitter: Vivek Yadav(@viveky259259)
#HappyCoding #flutter #widgets #crossplatform #tutorial #channel #viveky259 #procoach