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 windows
This 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/Release
to 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
.iss
extension, 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.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
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! π»