Skip to content

Flutter Build

Flutter allows you to build cross-platform mobile apps from a single codebase. This recipe demonstrates how to build iOS and Android apps using Flutter, including dependency installation and build compilation.

name: Flutter iOS Build
platform: flutter
environment:
flutter: "3.24.0"
triggers:
- push
- pull_request
steps:
- name: Install dependencies
run: fvm flutter pub get
- name: Build iOS
run: fvm flutter build ios
name: Flutter Mobile Build
platform: flutter
environment:
flutter: "3.24.0"
triggers:
- push
- pull_request
steps:
- name: Install dependencies
run: fvm flutter pub get
- name: Build Android
run: fvm flutter build apk
- name: Build iOS
run: fvm flutter build ios

The typical Flutter build workflow includes:

  1. Dependency Installation: fvm flutter pub get resolves all Pub dependencies specified in pubspec.yaml
  2. iOS Build: fvm flutter build ios generates an iOS app bundle
  3. Android Build: fvm flutter build apk generates an Android APK
  • pubspec.yaml: Your Flutter project’s manifest file, similar to Package.swift for native Swift or package.json for Node.js
  • pub get: Downloads and installs all dependencies from pub.dev
  • Platform-specific builds: Flutter can generate both iOS and Android builds from the same source code
  • .fvmrc file (optional): Commit this at your repository root to pin the Flutter SDK version; if you set environment.flutter: fvm, the agent will read the version from your .fvmrc file

You can collect build outputs from your Flutter builds:

name: Flutter Build with Artifacts
platform: flutter
environment:
flutter: "3.24.0"
triggers:
- push
steps:
- name: Install dependencies
run: fvm flutter pub get
- name: Build iOS
run: fvm flutter build ios
- name: Build Android
run: fvm flutter build apk
artifacts:
- build/ios/iphoneos/**/*.app
- build/ios/archive/**/*.xcarchive
- build/app/outputs/**/*.apk