This README provides instructions for creating a Windows installer for your Flutter application using Inno Setup.
Prerequisites 🛠️
- Build Flutter App for Windows: Run the following command in your Flutter project directory to generate the Windows build:
flutter build windowsThis will generate the build files in the build/windows/runner/Release directory.
- 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 📝
Prepare the Build Files
Copy all files frombuild/windows/runner/Releaseto a new directory, e.g.,C:\MyFlutterApp\ReleaseFiles.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-
Compile the Script
- Save the script with a
.issextension, for example,MyFlutterAppInstaller.iss. - Open Inno Setup and click Compile to generate the installer in the
OutputDir(C:\MyFlutterApp\Installer).
- Save the script with a
Test the Installer
Run the generatedMyFlutterAppSetup.exeto 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 scriptConclusion 🎉
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! 💻