31.8 Flutter App Bundle for Windows

20240201

Windows Exe Installer Using Inno Setup

Developed and tested by Anushka Vidanage 20231127:

Go to the app main directory in the terminal and run the following command.

flutter build window

This will create the release build for the windows app. When the building process is completed you will see the build release files in the following path:

<your_main_app_directory>\build\windows\x64\runner\Release

The .exe file with your app name will be there together with flutter_windows.dll and the data folder which contains all your app assets. If you are using additional plugins in your app, you will also see a few other .dll files.

To package this release the Inno Setup software can be used: https://jrsoftware.org/isdl.php. From this link download the latest version of the Inno Setup software. Install the software following the usual installation process on Windows.

After the installation start the application. The following windows will appear sequentially:

  1. Welcome window
  • The first time you start the application you will see a welcome window in which you will see two options: New file and Open file.
  • Under the New file option select Create a new script using the Script Wizard and click OK.
  1. Setup Script Wizard window
  • In the next window make sure the Create a new empty script file is unchecked and click OK.
  1. Application Information window
  • In the next window you can now include basic application details such as application name, version, publisher, etc. Fill out these information and click Next.
  1. Application folder window
  • In the next window you will have the ability to choose the default application destination folder. This is the folder that the application will get installed into by default when you run the installation setup.
  • Also provide a custom destination folder name (if necessary) and click Next.
  1. Application Files window
  • In the next window you have to provide the locations of the main application executable file and the relevant assets.
  • In the Application main executable file section include the location of your main .exe file which we created earlier. This is usually like the following:
<your_main_app_directory>\build\windows\x64\runner\Release\<your_app_name>.exe
  • You then have to add all the relevant files and folders for packaging. Include all the files and folders that exists in the same directory as the main .exe file.

IMPORTANT : If you have a folder called data in your app and when you add that folder to the Other application files, during the installation by default all the files and subfolders in that data folder will not be put into a directory called data in the installation directory. If that happens, your application will not work as expected.

To get around this, you have to first double click the added data folder entry. Then in the pop-up window under the option Destination subfolder add the folder name data. Click OK.

  • Click Next.
  1. Application File Association window
  • In the next window you have to provide the respective file association for your main executable file if you are planning to support specific file extensions.
  • If you are not doing that simply uncheck the option and click Next.
  1. Application Shortcuts window
  • In the next window you can specify what types of shortcuts you want for your installation to create. Select preferred options and click Next.
  1. Application Documentation window
  • In the next window you can now add respective licensing files and other related information for your application. Input those and click Next.
  1. Setup Install Mode window
  • In the next window you can select the preferred installation mode. Default is basic Administrative mode. Select preferred option and click Next.
  1. Setup Languages window
  • In the next window select preferred languages and click Next.
  1. Compiler Settings window
  • In the next screen you have to setup an output folder for the setup .exe file to be created.
  • Select a location for your compiler output and also give a name for your output .exe file.
<your_app_name> v1.0
  • You can also select an .ico file as an icon for your setup file.
  • You can setup a password for the output file as well but you do not have to do that. Click next.
  1. Inno Setup Preprocessor window
  • In the next window check Yes, use define compiler directives and click Next and then in the next window click Finish.

Once you click finish you will have a complete script file with all the options you selected during the setup wizard. For the first time you will also get a pop-up asking you whether you would like to compile the script now. Click Yes.

If you get another pop-up asking to save the script, click Yes and save the script in a preferred location.

After saving the script, the execution of the script will automatically start. Once its finished you will now be able to see an .exe file in the output folder you specified in the 11th screen above.

You can now use this .exe file to install your app in any machine that runs Windows. You will only need this .exe file as it packages up everything that is required for the app to run.


Changes to the application and creating a new .exe

If you make any changes to your app and need to create a new .exe file, you now do not have to go through the above process once again. Simply run the saved script again using Inno Setup Compiler to create a new .exe file.

In the script you can change the app version (MyAppVersion) and the output file name (OutputBaseFilename) to include the latest version info.

You can also change any other details you require in the script.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0