Packaging and Distributing Flutter Desktop Apps : The Missing Guide for Open Source & Indie Developers — Creating Windows .exe installer [Part 2 of 3]

Flutter Gems
7 min readJan 15, 2024

by Ashita Prasad (LinkedIn, Twitter), fluttergems.dev

Articles in this series:

In the previous article, we uncovered the motivation behind creating this step-by-step guide for packaging and distributing Flutter desktop apps the “indie” way or the open source way. We covered the entire process we follow (step-by-step) to build the macOS distribution (.dmg) of API Dash, an open source alternative to Postman that we have built completely using Flutter (GitHub repo👇).

In this article, we will go through the step-by-step process of creating a Windows executable file (.exe) to distribute your Flutter desktop app for Windows.

Packaging & Publishing Flutter Desktop App for Windows

To learn how to build & publish msix build for Windows check out the official docs on integration & deployment.

Step 1

Download & install the latest version of Visual Studio (Community edition is Free) from here.

Download and install the Inno setup software (link) which will help us create the Windows executable file.

Step 2

Open your Flutter project in VS Code & execute the build command in the terminal.

flutter build windows --release

It will create the .exe file along with some .dll files & the data folder containing assets in the following location:

C:\\path\to\project\build\windows\runner\Release

Step 3

The above files are not sufficient to distribute and run the app as Visual C++ runtime libraries are also required in the target (end-user) machine.

To ensure the availability of the required libraries, you can copy the following Visual Studio .dll files:

  • msvcp140.dll
  • msvcp140_1.dll
  • msvcp140_2.dll
  • vcruntime140.dll
  • vcruntime140_1.dll

from the below path (or similar path according to your Visual Studio version):

C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\
Redist\MSVC\14.34.31931\x64\Microsoft.VC143.CRT\

and place it alongside the other .dll files in the project build release folder.

Copy the VS .dll files to the Release folder

Step 4

Launch Inno Setup and create a new script using script wizard by clicking OK.

Inno Setup Script Wizard

Click Next on the Welcome screen shown below:

Welcome screen

Enter the application details like name, version, publisher name and website as shown below:

Application info

Select the destination base folder & application folder name as shown below. You can also allow the user to change this location.

Application folder

Click Browse and select the main .exe file that we had generated in Step 2.

Add main .exe file

Click Add file(s)… and select all the .dll files in the Release folder.

Add .dll files

Click Add folder… and add the data folder that was created earlier. This folder contains all the assets like fonts, images, etc.

Add data folder containing assets

Scroll down the list & select the data folder path and click on Edit… button.

Select data folder and click Edit

It is important to ensure that the destination sub-folder has the same name data otherwise the app wont run after installation as all contents of the folder are dispersed outside. So, enter the name of the Destination subfolder as data and click OK.

Enter destination subfolder name

Now, click on Next to proceed as shown below.

Click next to proceed.

In case you want to associate a file type to open with this application, specify the file type name and extension as shown below.

Associate file types

Specify if users can create shortcuts as shown below.

App shortcuts

In case your application has a Software License file, you can add the path to the license.txt as shown below. It can be any kind of license including open source license such as MIT, Apache-2, GPL, etc. The user will be shown the license while installing the application. Also, you can provide some information to be shown before & after software installation.

Add your software license.

Specify the install mode or allow the user to choose the install mode for the application as shown below.

Specify the install mode

Specify the setup languages that should be included.

Setup languages

Specify the output folder name along with the custom setup icon file. This will the path of the compiled exe file.

Compiler settings

Click on Next and then Finish to complete the Script Wizard as shown below.

Complete Script Wizard

Step 5

Once the Script Wizard is complete, an inno setup script is generated. This script has to be run to build the installer. You are prompted to compile the sript as shown below. Go ahead and press Yes.

In case you closed the prompt to make any modification to the script, you can click on the Run button as shown below to generate the windows .exe installer file.

This script can be easily edited and executed to create Windows installers for future app versions.

Step 6

The .exe file can be located in the output directory we specified in the previous step. The logo of the setup file is also the custom logo we selected in the previous step.

Generated Installer

Simply, double click to install the app on Windows. The installation process starts with the license screen as shown below.

Step 7

To distribute the app via GitHub, you can create a new release and attach the .exe file as shown below.

Once the release is published, the exe installer file will be available for download to all Windows users.

Closing Notes

In this article, we learnt how you can create a Windows executable (.exe) file to distribute your Flutter desktop app the “indie” or open source way. You can check out the other article in this series to learn how to do the same for other desktop platforms.

In case you have any doubts or queries please feel free to comment below or drop in our Discord Server.

This article is brought to you by Flutter Gems, a curated list of top Dart and Flutter packages that are categorized based on functionality. Do check it out below 👇

--

--

Flutter Gems

Maintained by Ashita Prasad, Flutter Gems is a curated package guide for Flutter ecosystem. Visit https://fluttergems.dev