Releasing Flutter projects on GitHub
If you’re working on a Flutter project and want to distribute it on GitHub, this article will guide you through the process.
Flutter is a popular open-source framework for building high-performance, high-fidelity mobile, web, and desktop applications. If you’re working on a Flutter project and want to distribute it on GitHub, this article will guide you through the process.
In this article, I will use NetShare as an example project. NetShare is an open-source Flutter project that makes it easy to share data in a local network. The latest release includes support for Android, macOS, Windows, and Linux platforms.
Android
Prepare the app icon by using your preferred design tool. You can use Adobe Illustrator to export a high-quality PNG icon and then use Android Studio to generate all density icons. For more information, see the official Create App Icons documentation.
Open
android
project (insideflutter
project) on Android Studio and add the app icon.Set up the release configuration/key per the guideline provided in the official Flutter documentation.
Build the release APK from the console on the Flutter project root directory:
flutter build apk
Upload the release APK to the Release on your GitHub project.
macOS
Design your app icon by using your preferred design tool. And then you may use appicon.co to generate all density icons.
Open the macOS project and update the AppIcon on XCode. Check official Apple documentation for more details.
Build the project from the console on the Flutter project root directory:
flutter build macos
. Sometimes, the old icon may be cached, and you need to run `flutter clean before building the app.On XCode, go to
Product > Archive
.Once the archive is finished, click on Distribute App.
Select the method of distribution as
Copy App
Compress the app to a zip file and upload it to Release on your GitHub project.
Windows
Update the app icon at
windows\runner\resources\app_icon.ico
Change the app name at
windows\runner\main.cpp
Execute
flutter build windows
Download and install Inno Setup
Open Inno Setup, create a new app, and follow step-by-step with protocoderspoint’s tutorial
Upload the output file to the Release on your GitHub project.
You may also want to try the MSIX distribution by following the official Flutter guideline.
Linux
Flutter apps can also be distributed on Linux using the Debian package format. To create a Debian package, we can use the flutter_to_debian
package.
Follow the instructions in the
flutter_to_debian
package documentation at https://pub.dev/packages/flutter_to_debian.Add
flutter_to_debian
to your system PATH by running the following command in your terminal:
export PATH="$PATH":"$HOME/.pub-cache/bin"
- Run
flutter_to_debian
from your Flutter project directory
huynq@ubuntu:~/Documents/WIP/netshare$ flutter_to_debian
checking for debian 📦 in root project... ✅
start building debian package... ♻️ ♻️ ♻️
No skeleton found
🔥🔥🔥 (debian 📦) build done successfully ✅
😎 find your .deb at
debian/packages/NetShare_2.0.0_amd64.deb
- Test the output by installing it locally using the
dpkg
command:
sudo dpkg -i NetShare_2.0.0_amd64.deb
- If the installation is successful and the app works as expected, upload output file to Releases on your GitHub project.
iOS
iOS distribution requires an Apple developer account. Instead, publishing app to the AppStore could be an option. Please see the guidelines at Build and release an iOS app for specific steps.
Web
Web is easy to distribute since there are various ways to do it. You could use Firebase hosting or other hosting services to host built web content.
Execute
flutter build web
. There are two renderershtml
andcanvaskit
that you can choose (see web renderers for more details).Check the output result locally with your local web server (node/python/…). I use Python server as an example:
cd build/web
python -m http.server 8000
This will start a web server at http://localhost:8000 that serves the output files in the build/web
directory.
- Deploy web by your favorite service (see deploy-to-the-web).
Conclusion
In this article, we have walked through the steps of releasing a Flutter project on GitHub. Each platform requires specific configuration and tooling, but with the appropriate guidelines and references, you can distribute your app on any platform you choose. By following these guidelines and distributing your Flutter project on GitHub, you can reach a wider audience and make your project accessible to others.
Thank you for reading this article, and I hope that it will be helpful in guiding you through the process of releasing your Flutter project on GitHub.
Also, if you are interested in the NetShare project, please keep up with the progress by following project on Github and Twitter:
Github project: https://github.com/huynguyennovem/netshare
Twitter: https://twitter.com/NetShareOSS
Maintainer: https://twitter.com/HuyNguyenTw
Thanks for reading!