If you want to distribute your app to your users, you need something to give them. On Android you would have an apk file and on iOS you would have an ipa file. Now with flutter, you can build a release version of the app as either a mac .app file or a windows .exe file. These files run on their own and don’t require flutter or any other development environment. They are fast and can be distributed. Now to actually distribute the files you will need to work with the Apple store for the mac version and the windows store for the windows version. You can go to https://flutter.dev/desktop to read more about distribution.
Terminal
To build a release build for the Mac, go to the terminal app and go to your project directory. Now type:
flutter build macos
If you go to /build/macos/Build/Products/Release you will see your Todo.app file with the icon we created in the previous episode. Go ahead and double click on the app to start it and make sure it works correctly.
PowerShell
On Windows we need to do something similar. Open up PowerShell or CMD. Go to the project directory and type:
flutter build windows
Go to build -> windows -> runner -> release. You will see Todo.exe with the icon we created earlier. Double click to run the app and make sure it works correctly.
To create a Windows installer, you can use the msix plugin. Add the plugin by typing:
flutter pub add --dev msix
Android Studio
Inside of pubspec.yaml add the following configuration:
msix_config:
display_name: Todo
publisher_display_name: Your Company Name
identity_name: com.kodeco.todo
msix_version: 1.0.0.0
capabilities: internetClient
There are many more parameters you can use from signing, to publishing. Now from the terminal type:
flutter pub run msix:create
Congratulations. You’ve now built Flutter desktop apps for both the Mac and windows platforms!