|
| 1 | +Publishing a **Linux desktop app made with Flutter** involves packaging it properly and distributing it through a method that fits your audience (e.g. direct download, GitHub, PPA, Snap, Flatpak, etc.). |
| 2 | + |
| 3 | +Here’s a complete **step-by-step guide from scratch** tailored for a Flutter Linux app. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## ✅ STEP 0: Prerequisites |
| 8 | + |
| 9 | +Make sure you have: |
| 10 | + |
| 11 | +* Flutter installed and working with desktop support (`flutter doctor`) |
| 12 | +* `dpkg-deb`, `cmake`, `make`, `gcc`, and `glib` installed on Ubuntu |
| 13 | +* Your Flutter app is already working on Linux (`flutter run -d linux`) |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## ✅ STEP 1: Build the App for Release |
| 18 | + |
| 19 | +```bash |
| 20 | +flutter build linux --release |
| 21 | +``` |
| 22 | + |
| 23 | +This creates your app in: |
| 24 | + |
| 25 | +``` |
| 26 | +build/linux/x64/release/bundle/ |
| 27 | +``` |
| 28 | + |
| 29 | +Contents: |
| 30 | + |
| 31 | +* `ir_net` (binary) |
| 32 | +* `flutter_assets/` (assets) |
| 33 | +* Shared libraries |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## ✅ STEP 2: Create Debian Package Structure |
| 38 | + |
| 39 | +Structure your `.deb` folder manually: |
| 40 | + |
| 41 | +```bash |
| 42 | +mkdir -p ir_net_pkg/DEBIAN |
| 43 | +mkdir -p ir_net_pkg/usr/bin/ir_net |
| 44 | +mkdir -p ir_net_pkg/usr/share/applications |
| 45 | +mkdir -p ir_net_pkg/usr/share/icons/hicolor/256x256/apps |
| 46 | +``` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## ✅ STEP 3: Copy Build Output |
| 51 | + |
| 52 | +```bash |
| 53 | +cp -r build/linux/x64/release/bundle/* ir_net_pkg/usr/bin/ir_net/ |
| 54 | +``` |
| 55 | + |
| 56 | +Make sure the binary is executable: |
| 57 | + |
| 58 | +```bash |
| 59 | +chmod +x ir_net_pkg/usr/bin/ir_net/ir_net |
| 60 | +``` |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## ✅ STEP 4: Create Control File |
| 65 | + |
| 66 | +Create `ir_net_pkg/DEBIAN/control`: |
| 67 | + |
| 68 | +```text |
| 69 | +Package: ir-net |
| 70 | +Version: 1.0.0 |
| 71 | +Section: utils |
| 72 | +Priority: optional |
| 73 | +Architecture: amd64 |
| 74 | +Depends: libgtk-3-0, libglib2.0-0 |
| 75 | +Maintainer: Your Name <you@example.com> |
| 76 | +Description: IR Net – A Flutter desktop app for Linux. |
| 77 | +``` |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## ✅ STEP 5: Add .desktop Launcher |
| 82 | + |
| 83 | +Create `ir_net_pkg/usr/share/applications/ir_net.desktop`: |
| 84 | + |
| 85 | +```desktop |
| 86 | +[Desktop Entry] |
| 87 | +Name=IR Net |
| 88 | +Comment=IR Net Desktop App |
| 89 | +Exec=/usr/bin/ir_net/ir_net |
| 90 | +Icon=ir_net |
| 91 | +Terminal=false |
| 92 | +Type=Application |
| 93 | +Categories=Utility; |
| 94 | +``` |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## ✅ STEP 6: Add App Icon |
| 99 | + |
| 100 | +Put your 256x256 PNG icon in: |
| 101 | + |
| 102 | +```bash |
| 103 | +cp linux/assets/icon.png ir_net_pkg/usr/share/icons/hicolor/256x256/apps/ir_net.png |
| 104 | +``` |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +## ✅ STEP 7: Build the `.deb` Package |
| 109 | + |
| 110 | +```bash |
| 111 | +dpkg-deb --build ir_net_pkg |
| 112 | +``` |
| 113 | + |
| 114 | +This creates: |
| 115 | + |
| 116 | +``` |
| 117 | +ir_net_pkg.deb |
| 118 | +``` |
| 119 | + |
| 120 | +Rename it if you like: |
| 121 | + |
| 122 | +```bash |
| 123 | +mv ir_net_pkg.deb ir-net_1.0.0_amd64.deb |
| 124 | +``` |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## ✅ STEP 8: Test Your Package |
| 129 | + |
| 130 | +```bash |
| 131 | +sudo dpkg -i ir-net_1.0.0_amd64.deb |
| 132 | +``` |
| 133 | + |
| 134 | +To fix missing dependencies: |
| 135 | + |
| 136 | +```bash |
| 137 | +sudo apt-get install -f |
| 138 | +``` |
| 139 | + |
| 140 | +Then launch your app from the system menu or via: |
| 141 | + |
| 142 | +```bash |
| 143 | +/usr/bin/ir_net/ir_net |
| 144 | +``` |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## ✅ STEP 9: Distribute Your App |
| 149 | + |
| 150 | +Here are common methods to publish: |
| 151 | + |
| 152 | +### 🔹 GitHub Releases (Simple, Direct) |
| 153 | + |
| 154 | +1. Create a GitHub repo (if you haven’t) |
| 155 | +2. Upload your `.deb` file in the "Releases" section |
| 156 | +3. Share the link (e.g. [https://github.com/you/ir\_net/releases](https://github.com/you/ir_net/releases)) |
| 157 | + |
| 158 | +### 🔹 Snapcraft (Canonical) |
| 159 | + |
| 160 | +Use if you want your app in the **Snap Store**. You'll need: |
| 161 | + |
| 162 | +* A Snapcraft.yaml file |
| 163 | +* An account at [https://snapcraft.io](https://snapcraft.io) |
| 164 | +* Snapcraft CLI |
| 165 | + |
| 166 | +Let me know if you want this path — it's a bit more involved. |
| 167 | + |
| 168 | +### 🔹 Flatpak (Flathub) |
| 169 | + |
| 170 | +Alternative to Snap. Good for wide desktop support. |
| 171 | + |
| 172 | +### 🔹 Personal APT Repo or Launchpad PPA |
| 173 | + |
| 174 | +If you want users to `apt install ir-net`: |
| 175 | + |
| 176 | +* Host your `.deb` files on a web server or Launchpad |
| 177 | +* Sign your packages |
| 178 | +* Create a repository index |
| 179 | + |
| 180 | +Let me know if you want to go this route. |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## ✅ Recap Checklist |
| 185 | + |
| 186 | +| ✅ Task | Done? | |
| 187 | +| --------------------------- | ----- | |
| 188 | +| `flutter build linux` | ✔️ | |
| 189 | +| Create `.deb` structure | ✔️ | |
| 190 | +| Add control & desktop files | ✔️ | |
| 191 | +| Include icon and binary | ✔️ | |
| 192 | +| Build & test `.deb` package | ✔️ | |
| 193 | +| Upload or publish | ⬜ | |
| 194 | + |
| 195 | +--- |
0 commit comments