DEV Community

Cover image for Creating Easy Windows Installers for Flutter Apps with Inno Bundle
Hocine Abdellatif Houari
Hocine Abdellatif Houari

Posted on • Edited on

Creating Easy Windows Installers for Flutter Apps with Inno Bundle

Every Flutter project follows a familiar journey: coding, designing, testing, and sharing that masterpiece with the world. That final step however differs for every platform. On Android, we used to build APK or AAB files that are either distributed as is or uploaded to Play Store. With IOS and AppStore is a similar story. But when it comes to Desktop, specifically Windows which holds ~69% of Desktop Market share worldwide, this step presents a hurdle. Enter the world of desktop Installer.

Trying MSIX: Powerful, But My Simple EXE Cried

MSIX seemed to be the only option that stands out for building Windows Installers. The docs were a treat. But when crafting the Installer for my client, the complexity left me scratching my head.

It's a great pick for those targeting Microsoft Store, for its customization and adhering to Windows Standards. My biggest pain with it was the Signed certificates! Unfortunately, Windows Home edition (my case) doesn't allow creating certificates, yet they are required (Security measures) for other users to be able to use my installer, and the commands to generate them are not friendly at all. The decision was made to look for alternatives, to find none, so I had to create one.

Welcome Inno Bundle

Inno Bundle is a command-line tool that simplifies bundling your app into an EXE installer for Microsoft Windows. The package will figure out the metadata like app version and description, etc. With friendly customizability, and easy steps to follow.

1. Download Inno Setup

  • Option 1: Using winget


winget install -e --id JRSoftware.InnoSetup


Enter fullscreen mode Exit fullscreen mode
  • Option 2: Download installer from website

Visit the official Inno Setup website.
Download the latest version (tested with 6.2.2) and install it on your machine.

2. Add inno_bundle package to your project



dart pub add dev:inno_bundle


Enter fullscreen mode Exit fullscreen mode

3. Give Your App a Unique Identity

To generate a random id run:



dart run inno_bundle:id


Enter fullscreen mode Exit fullscreen mode

Or base it upon a namespace:



dart run inno_bundle:id --ns "www.example.com"


Enter fullscreen mode Exit fullscreen mode

The output id is going to be something similar to this:

f887d5f0-4690-1e07-8efc-d16ea7711bfb

Copy & Paste the output to your pubspec.yaml as shown in the next step.

4. Set up the Configuration

Add your configuration to your pubspec.yaml. example:



inno_bundle:
 id: f887d5f0-4690-1e07-8efc-d16ea7711bfb # <-- Put your own generated id here
 publisher: Your Name # Optional, but recommended.


Enter fullscreen mode Exit fullscreen mode

Make sure you do not change your id after first deployment, if you do, when the end-user tries to update your app, his machine will recognize the update as a different app due to different AppId, he will have later to uninstall the old version manually.

5. Build Time

With configuration in place, let the magic happen:



dart run inno_bundle:build --release


Enter fullscreen mode Exit fullscreen mode

The command will build the app, then build the installer. The installer should generate on <project-dir>\build\windows\x64\installer\Release folder.

Additional Feature

All flutter apps on windows face an issue to run on end users machine that are missing MS C++ Visual Redistributable. The issue will appear as some DLL files missing:
vcruntime140d.dll is missing
These DLL files msvcp140.dll, vcruntime140.dll, vcruntime140_1.dll are also bundled automatically with the app when creating the installer, saving you a precious time.

For more customized installer, checkout available attributes, and other configuration examples.

That's it! Hope this package provides better experience to Flutter developers. If you find it useful please hit the ❤️ button
Cheers.

About the Author

A Flutter and Web apps developer, Member of Web development team, and a lead developer on Flutter team. Giving back to community on free time. Answering for the unaddressed, for the sake of a shared future.

Top comments (1)

Collapse
 
marcbentoy profile image
Marc Bentoy

Thank you for this. This is way quicker!