TExcelTAD
Home › Flutter › Build & Deploy

Flutter Build & Deploy

During development you run your app with flutter run in debug mode: hot reload works, assertions are checked and the code is not optimised. To ship an app to real users you create a release build — compiled ahead-of-time to fast native code — and publish it to an app store or a web server.

Build modes

Mode Command Use
Debug flutter run Development, hot reload, debugging
Profile flutter run --profile Measuring performance on a real device
Release flutter run --release / flutter build … What users get: smallest and fastest

Before you build

  1. App name and identifier — set the bundle ID / application ID (e.g. com.example.notes) in android/app/build.gradle(.kts) and in Xcode. It must be unique in the stores and cannot change later.
  2. Version — in pubspec.yaml:
yaml
version: 1.2.0+7   # versionName 1.2.0, build number 7

Increase the build number for every upload. 3. Icon and splash screen — packages like flutter_launcher_icons and flutter_native_splash generate all sizes from one image. 4. Permissions — declare what you use (internet, camera, location) in AndroidManifest.xml and Info.plist. 5. Check the project with the analyzer and tests:

bash · try it yourself
flutter analyze && flutter test
Analyzing notes...
No issues found! (ran in 2.1s)
00:04 +12: All tests passed!

Android

The Play Store expects an App Bundle (.aab), from which Google generates optimised APKs for each device. Release builds must be signed with your upload key (configured in android/key.properties, which you never commit to git).

bash · try it yourself
flutter build appbundle --release
Running Gradle task 'bundleRelease'...                         48.3s
✓ Built build/app/outputs/bundle/release/app-release.aab (18.4MB)

Upload the .aab in the Google Play Console, fill in the store listing, and roll it out to internal testing first. For sideloading or other stores, flutter build apk --split-per-abi produces smaller APKs per CPU architecture.

iOS

iOS builds require a Mac with Xcode and an Apple Developer account.

bash · try it yourself
flutter build ipa --release
Archiving com.example.notes...
Building App Store IPA...                                      74.6s
✓ Built IPA to build/ios/ipa (21.7MB)
To upload to the App Store either:
    1. Drag and drop the "build/ios/ipa/*.ipa" bundle into the Apple Transporter macOS app
    2. Run "xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa ..."

Then distribute to testers with TestFlight and submit for App Store review.

Web

A web build is a folder of static files you can host anywhere: Firebase Hosting, GitHub Pages, Netlify, or any web server.

bash · try it yourself
flutter build web --release --base-href /notes/
Compiling lib/main.dart for the Web...                         21.9s
✓ Built build/web

Use --base-href when the app is served from a sub-folder. Add --wasm to compile to WebAssembly for faster performance in supporting browsers.

Desktop

bash · try it yourself
flutter build windows
Building Windows application...                                39.2s
✓ Built build\windows\x64\runner\Release\notes.exe

Similarly flutter build macos and flutter build linux — each must be run on that operating system.

Configuration per environment

Pass compile-time values, such as an API URL, without hard-coding them:

bash · try it yourself
flutter build apk --dart-define=API_URL=https://api.example.com
✓ Built build/app/outputs/flutter-apk/app-release.apk (19.8MB)

Read it in Dart with const apiUrl = String.fromEnvironment('API_URL', defaultValue: 'http://localhost:8080');.

Tip: flutter build apk --analyze-size (or appbundle/ipa) shows which packages and assets make your app big.

Note: Automate releases with CI (GitHub Actions, Codemagic, Bitrise) or fastlane, so every build is reproducible and signing keys stay out of developers' laptops.

Test yourself

Which file format should you upload to the Google Play Store?

  1. .apk only
  2. .aab (App Bundle)
  3. .ipa
  4. .exe

In version: 2.0.1+15, what is 15?

  1. The minimum SDK
  2. The build number
  3. The Dart version
  4. The number of screens

Which build mode is optimised for end users?

  1. Debug
  2. Profile
  3. Release
  4. Hot reload