home / skills / rodydavis / skills / flutter-and-xcode-cloud

flutter-and-xcode-cloud skill

/skills/flutter-and-xcode-cloud

This skill guides you to configure Xcode Cloud for building and deploying a Flutter app to TestFlight and the App Store.

npx playbooks add skill rodydavis/skills --skill flutter-and-xcode-cloud

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.0 KB
---
name: how-to-build-a-flutter-app-on-xcode-cloud
description: Learn how to set up Xcode Cloud to build and deploy your Flutter application to TestFlight and the App Store with this step-by-step guide.
metadata:
  url: https://rodydavis.com/posts/flutter-and-xcode-cloud
  last_modified: Tue, 03 Feb 2026 20:04:22 GMT
---

# How to build a Flutter app on Xcode Cloud


In this article we are going to go over how to setup [Xcode Cloud](https://developer.apple.com/xcode-cloud/) to build your [Flutter](https://flutter.dev/) application for [TestFlight](https://developer.apple.com/testflight/) and the [AppStore](https://developer.apple.com/app-store/).

## Step 1 

Before we begin Flutter needs to be installed, and you can check by running the following:

```
flutter doctor -v
```

After it is installed we can run the following command to create and open our Flutter project (skip down to step 2 if adding to an existing app).

```
mkdir flutter_ci_example
cd flutter_ci_example
flutter create .
```

If you need more help with creating the first project you can check out my previous blog post [here](https://rodydavis.com/posts/first-flutter-project/).

After the project is created open it in your favorite code editor.

```
code .
```

## Step 2 

The generated files should look like the following:

![](https://rodydavis.com/_/../api/files/pbc_2708086759/pl153678e69f0qk/x_1_qw8btmibvc.webp?thumb=)

Create a new file at `ios/ci_scripts/ci_post_install.sh` and update it with the following:

```
#!/bin/sh

# Install CocoaPods using Homebrew.
brew install cocoapods

# Install Flutter
brew install --cask flutter

# Run Flutter doctor
flutter doctor

# Get packages
flutter packages get

# Update generated files
flutter pub run build_runner build

# Build ios app
flutter build ios --no-codesign
```

This is a file Xcode Cloud needs to run after the project is downloaded. We need to install [cocoapods](https://cocoapods.org/) for any plugins we are using and Flutter to prebuild our application.

Then run the following command which will make the script executable:

```
chmod +x ios/ci_scripts/ci_post_clone.sh
```

## Step 3 

Open up the iOS project in Xcode by right clicking on the iOS folder and selecting "Open in Xcode".

![](https://rodydavis.com/_/../api/files/pbc_2708086759/u0cveo6hhi22s90/x_2_i34bfwz1u0.webp?thumb=)

You can also open the project by double clicking on the `ios/Runner.xcworkspace` file.

![](https://rodydavis.com/_/../api/files/pbc_2708086759/day67g90vkws5q3/x_3_80qu3qrdlp.webp?thumb=)

Make sure you have the latest version of Xcode Cloud install and that you have [access to the beta](https://developer.apple.com/xcode-cloud/beta/). Create a new workflow by the menu `Product > Xcode Cloud > Create Workflow`:

![](https://rodydavis.com/_/../api/files/pbc_2708086759/qfz8667e0y89hkh/x_4_xsrdzbddjh.webp?thumb=)

Follow the flow to add the project and choose which type of build you want.

Make sure to remove MacOS as a target in the workflow by selecting `Archive - MacOS` and the delete icon on the top right.

If you want to build and release the MacOS app you will need to do that with another script in the macos folder and a workflow in that Xcode workspace.

You can create the file `macos/ci_scripts/ci_post_clone.sh` and update it with the following:

```
#!/bin/sh

# Install CocoaPods using Homebrew.
brew install cocoapods

# Install Flutter
brew install --cask flutter

# Run Flutter doctor
flutter doctor

# Enable macos
flutter config --enable-macos-desktop

# Get packages
flutter packages get

# Update generated files
flutter pub run build_runner build

# Build ios app
flutter build ios --no-codesign
```

If all goes well it will look like the following after a successful build:

![](https://rodydavis.com/_/../api/files/pbc_2708086759/6ubskgc91jv51ha/x_5_zgz4x31cbp.webp?thumb=)

## Conclusion 

Flutter makes it ease to build and deploy to multiple platforms and Xcode Cloud takes care of the signing for Apple platforms.

You can learn more about cd and flutter [here](https://docs.flutter.dev/deployment/cd).

Overview

This skill teaches how to configure Xcode Cloud to build and deploy a Flutter iOS app to TestFlight and the App Store. It provides a step-by-step approach for preparing a Flutter project, adding CI scripts, and creating Xcode Cloud workflows. The guide focuses on automating dependency installation, prebuilding Flutter artifacts, and producing an unsigned iOS archive ready for Apple signing.

How this skill works

The skill walks through creating small shell scripts (post-clone/post-install) that Xcode Cloud runs to install CocoaPods and Flutter, run flutter doctor, fetch packages, run build_runner, and run flutter build ios --no-codesign. It shows how to open the iOS workspace in Xcode, create a Cloud workflow, and exclude macOS targets when not needed. Optionally it explains how to add a similar macOS script and workflow for desktop builds.

When to use it

  • You want automated CI builds of a Flutter iOS app using Xcode Cloud.
  • You need to deploy builds to TestFlight or the App Store with Apple-managed signing.
  • Your Flutter project uses native iOS plugins that require CocoaPods.
  • You want a repeatable prebuild step to generate code and assets before Xcode builds.
  • You need separate CI steps for macOS desktop builds.

Best practices

  • Keep CI scripts under ios/ci_scripts and mark them executable (chmod +x).
  • Install CocoaPods and Flutter via Homebrew in the post-clone/post-install scripts to ensure the build host has required tools.
  • Run flutter packages get and flutter pub run build_runner build before building to pre-generate code and assets.
  • Use flutter build ios --no-codesign in CI; let Xcode Cloud handle signing and notarization.
  • Exclude unwanted targets (like macOS) from the workflow if you only build iOS to avoid unnecessary steps.

Example use cases

  • New Flutter app: add the ios/ci_scripts script and create an Xcode Cloud workflow to automate iOS releases.
  • Existing multi-platform app: use separate CI scripts and workflows for iOS and macOS builds.
  • Plugin-heavy app: ensure CocoaPods installs on the CI host to resolve native dependencies before building.
  • Teams delivering frequent beta builds: automate TestFlight uploads through Xcode Cloud using the unsigned archive from flutter build ios.

FAQ

Do I need to sign the app in the CI script?

No. Use flutter build ios --no-codesign; Xcode Cloud handles signing when you configure the workflow and provisioning profiles.

What if my project already has generated code?

Still run build_runner in CI to ensure generated files are up to date; it avoids build-time failures on the cloud host.