Publishing Your Flutter App to Google Play and App Store

Tutorial 5 of 5

1. Introduction

The goal of this tutorial is to guide you through the process of publishing your Flutter app to Google Play Store and Apple App Store. Upon completion of this guide, you will be able to:

  • Prepare your Flutter app for release
  • Generate a signed Android APK and iOS IPA for your app
  • Submit your app to Google Play Store and Apple App Store

Prerequisites:
- Basic knowledge of Flutter development
- Flutter SDK installed on your development machine
- An app made with Flutter
- Active developer accounts on Google Play and Apple's App Store

2. Step-by-Step Guide

2.1 Preparing for Release

Before you can submit your Flutter app to the app stores, you need to prepare it for release. This involves setting up an app icon, splash screen, version number, and build number.

Example:

// Your pubspec.yaml should look something like this:
name: my_app
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

In the above code snippet, 1.0.0 is the version number and 1 is the build number. These numbers should be incremented with each new release.

2.2 Building the App Bundle

Once your application is ready for release, you need to generate a signed Android App Bundle (.aab) or an iOS App Archive (.ipa).

Example:

For Android:

flutter build appbundle

For iOS:

flutter build ios

2.3 Submitting the App

The last step is to submit your app to Google Play Store and Apple App Store.

Example:

For Google Play Store, you can use the Google Play Console to upload your .aab file. For Apple App Store, you can use the Xcode to upload your .ipa file.

3. Code Examples

Let's see some practical examples:

3.1 Setting the App Icon

You can set the app icon in the pubspec.yaml file.

flutter:
  uses-material-design: true
  assets:
    - images/
  module:
    androidX: true
  plugin:
    androidPackage: com.example.myapp
    pluginClass: MyAppPlugin

In the above code snippet, images/ is the directory where you will place your app icon.

3.2 Building the Android App Bundle

flutter build appbundle --release

This command generates a signed Android App Bundle in the build/app/outputs/bundle/release/ directory.

3.3 Building the iOS App Archive

flutter build ios --release

This command generates a signed iOS App Archive in the build/ios/iphoneos/ directory.

4. Summary

In this tutorial, we covered:

  • Preparing a Flutter app for release
  • Building the app bundle for Android and iOS
  • Submitting the app to Google Play and Apple App Store

5. Practice Exercises

  1. Create a simple Flutter app and prepare it for release.
  2. Build the Android App Bundle and iOS App Archive for the app.
  3. Try submitting the app to Google Play Store and Apple App Store.

Remember, practice is the key to mastering any skill. Happy coding!