Sub topic 1
Debug, profile, and release: what changes in a release build
This chapter assumes you know Dart and Flutter basics, can run flutter commands in a terminal, and have a working debug build on Android or iOS.
Prerequisites
- Flutter SDK installed, with
flutter doctorreporting no blocking issues - Android Studio installed, and Xcode on macOS for iOS work
- Familiarity with Gradle (Android) and Xcode project settings is helpful but not required
Debug, profile, and release: what changes in a release build
Flutter has three build modes. Debug mode enables hot reload and assertions, and it runs slower. Profile mode keeps performance tooling active while stripping debug features. Release mode applies full optimization, disables debugging, and produces the build you submit to a store.
| Mode | Purpose | Optimized | Debuggable |
|---|---|---|---|
| debug | Development and hot reload | No | Yes |
| profile | Measuring performance | Yes | Partly |
| release | Store submission | Yes | No |
The android and ios folders you will edit
Each Flutter project contains an android folder and an ios folder. The Android folder holds Gradle files, including android/app/build.gradle.kts. The iOS folder holds the Xcode project, including ios/Runner/Info.plist. Most release settings live in these two folders, not in lib.
Setting the application ID, bundle identifier, and app name
The application ID (Android) and bundle identifier (iOS) uniquely identify your app in the stores. Set them once and keep them stable, because changing them makes the store treat the app as a new one.
// android/app/build.gradle.kts
android {
defaultConfig {
applicationId = "com.example.myapp"
}
}Set the iOS bundle identifier in Xcode under the Runner target's Signing & Capabilities tab. The display name shown under the icon comes from CFBundleDisplayName in Info.plist on iOS and android:label in AndroidManifest.xml on Android.
Versioning with version name and build number
Flutter reads the version from pubspec.yaml. The part before the plus sign is the version name, which users see. The number after the plus sign is the build number, which each store upload must increase.
# pubspec.yaml
version: 1.2.0+7> Do not reuse a build number. Both Google Play and App Store Connect reject an upload whose build number is not higher than the previous one.
Exercise
The pubspec version is 1.2.0+7. Which value does Play Console compare when you upload a new build, and what should the next upload use?
Show answer
Play compares the build number, which is 7. The next upload needs a build number higher than 7, for example 1.2.0+8 or 1.2.1+8.