How to build a single EXE file from flutter windows build

Agnel Selvan
5 min readFeb 1, 2022

--

In this blog, we will be looking at how to build a .exe file from flutter windows build using Inno-Setup-Compiler.

So Let’s start by simply creating a new Flutter Project

After running the project

In my case, I’m just going to build .exe for the default Flutter template.

Change App’s window name If required.

Navigate to project_root_dir/windows/runner/main.CPP file. and in the window.CreateAndShow(L” Yours window name”, origin, size) line change your window name

Change Apps Icon if required

Navigate to project_root_dir/windows/runner/resources and replace the app_icon with your new app icon. and please note image has to be in the .ico file.
I referred to this website to convert a PNG image

Now Lets do build for windows

Run flutter build windows in cmd.

Downloading Inno-Setup

Download this Inno-Setup from the official website. So this tool is basically used for generating a exe file by providing a bunch of files to the setup compiler.

Once installed, open the Inno-Setup application and click on File -> New.
A window will popup like so,

Now click Next

Enter all the details i.e your App name, version, publisher, and website. Now click Next

If you are sure your application doesn’t need a folder then in that case you can check that box.
If you don’t want the user to change the application folder then in that case you can uncheck that checkbox.
You have 2 options for choosing the application destination folder.
1. Program Files Folder: It will save the projects in Program files.
2. Custom: It will ask the location from you to save the projects files.
In my case, I’m just choosing the Program Files Folder.
Click Next.

NOTE: Nowhere if we analyze the build you can see the data Folder and flutter_windows.dll file without using these files and folders you cannot run your application.

Here for the main executable file navigate to project_root_dir\build\windows\runner\Release and select the main application file.
Click on Add Folder and select the Release folder from the folder selector tab so that all the sub-folders and files will be added in the windows build.
and then click on Add File and select the flutter_windows.dll file. Once done click Next

Here change the File type extension to .exe and click Next.

Simply click Next.

If you have a license you can locate it to that directory or else simply click Next.

Simply click Next.

If you want to specify any specific language for installation you are free to choose any language and then click Next.

Choose the output folder when the exe file is built I have chosen the projects_root_dir/exe folder location.
The Exe Name has to be specified in Output Base File Name.
And locate the setup icon file.
Then click Next.

Simply click Next.

Finally, click on Finish and save the script .

After Saving the script click on Build > Compile so that the scripts gets compiled and once the script is compiled click on Open Output Folder and it will open the folder where the script output is stored.

And now you can run this Application File and after the Installation, you will see the Flutter desktop application in your windows machine.

Hurrah! and we are done with the windows exe build.

Do you know you can press the clap👏 button 50 times? The higher you go, the more it motivates me to write more stuff for you guys!
Hello, I am Agnel Selvan. A noob developer. You can find me on Linkedin or stalk me on GitHub.

If you like my work or the free stuff on this website and want to say thanks or encourage me to do more, you can buy me a coffee!

--

--

Agnel Selvan

A person who is learning Flutter Development, Shaders, OpenGL, and Augmented Reality.