DEV Community

Cover image for Flutter Windows Installer πŸš€
AYON KARMAKAR
AYON KARMAKAR

Posted on

3 3 3 3 3

Flutter Windows Installer πŸš€

This README provides instructions for creating a Windows installer for your Flutter application using Inno Setup.


Prerequisites πŸ› οΈ

  1. Build Flutter App for Windows: Run the following command in your Flutter project directory to generate the Windows build:
   flutter build windows
Enter fullscreen mode Exit fullscreen mode

This will generate the build files in the build/windows/runner/Release directory.

  1. Install Inno Setup: Download and install Inno Setup from jrsoftware.org or Direct Download Link innosetup-6.4.0.exe.

Steps to Create the Installer πŸ“

  1. Prepare the Build Files
    Copy all files from build/windows/runner/Release to a new directory, e.g., C:\MyFlutterApp\ReleaseFiles.

  2. Create the Inno Setup Script
    Open Inno Setup and create a new script with the following content:

   [Setup]
   AppName=MyFlutterApp
   AppVersion=1.0.0
   DefaultDirName={pf}\MyFlutterApp
   DefaultGroupName=MyFlutterApp
   OutputDir=C:\MyFlutterApp\Installer
   OutputBaseFilename=MyFlutterAppSetup
   Compression=lzma
   SolidCompression=yes

   [Files]
   Source: "C:\MyFlutterApp\ReleaseFiles\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

   [Icons]
   Name: "{group}\MyFlutterApp"; Filename: "{app}\MyFlutterApp.exe"
   Name: "{group}\Uninstall MyFlutterApp"; Filename: "{uninstallexe}"

   [Run]
   Filename: "{app}\MyFlutterApp.exe"; Description: "Launch MyFlutterApp"; Flags: nowait postinstall skipifsilent
Enter fullscreen mode Exit fullscreen mode
  1. Compile the Script

    • Save the script with a .iss extension, for example, MyFlutterAppInstaller.iss.
    • Open Inno Setup and click Compile to generate the installer in the OutputDir (C:\MyFlutterApp\Installer).
  2. Test the Installer
    Run the generated MyFlutterAppSetup.exe to ensure the installer works as expected.


Customization Options 🎨

  • Update Paths: Change file paths in the script to match your project’s structure.
  • Add Additional Files: Include licenses or documentation by adding entries to the [Files] section.
  • Uninstaller: Inno Setup automatically includes an uninstaller for your application.

Example Project Structure πŸ—‚οΈ

C:\MyFlutterApp
β”œβ”€β”€ ReleaseFiles  # Contains built application files
β”‚   β”œβ”€β”€ MyFlutterApp.exe
β”‚   β”œβ”€β”€ data
β”‚   └── ...
β”œβ”€β”€ Installer      # Generated installer output
β”‚   └── MyFlutterAppSetup.exe
└── MyFlutterAppInstaller.iss  # Inno Setup script
Enter fullscreen mode Exit fullscreen mode

Conclusion πŸŽ‰

By following these steps, you can create a professional installer for your Flutter Windows application. This will make it easier for users to install and use your app. If you have any questions or feedback, feel free to leave a comment below. Happy coding! πŸ’»

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil β€” patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Image of Stellar post

πŸš€ Stellar Dev Diaries Series: Episode 1 is LIVE!

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

πŸ‘‹ Kindness is contagious

Explore this insightful post in the vibrant DEV Community. Developers from all walks of life are invited to contribute and elevate our shared know-how.

A simple "thank you" could lift spiritsβ€”leave your kudos in the comments!

On DEV, passing on wisdom paves our way and unites us. Enjoyed this piece? A brief note of thanks to the writer goes a long way.

Okay