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.
Flutter iOS Build YAML
Section titled “Flutter iOS Build YAML”name: Flutter iOS Buildplatform: flutter
environment: flutter: "3.24.0"
triggers: - push - pull_request
steps: - name: Install dependencies run: flutter pub get
- name: Build iOS run: flutter build iosFlutter Cross-Platform Build
Section titled “Flutter Cross-Platform Build”name: Flutter Mobile Buildplatform: flutter
environment: flutter: "3.24.0"
triggers: - push - pull_request
steps: - name: Install dependencies run: flutter pub get
- name: Build Android run: flutter build apk
- name: Build iOS run: flutter build iosBuild Workflow
Section titled “Build Workflow”The typical Flutter build workflow includes:
- Dependency Installation:
flutter pub getresolves all Pub dependencies specified inpubspec.yaml - iOS Build:
flutter build iosgenerates an iOS app bundle - Android Build:
flutter build apkgenerates an Android APK
Key Points
Section titled “Key Points”- pubspec.yaml: Your Flutter project’s manifest file, similar to
Package.swiftfor native Swift orpackage.jsonfor 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.fvmrcfile
Building an iOS IPA from Flutter
Section titled “Building an iOS IPA from Flutter”When auto-signing is fully configured, you can build and export an iOS IPA directly from Flutter:
name: Flutter Build IPAplatform: flutter
environment: flutter: "3.41.8"
triggers: - push
steps: - name: Get dependencies run: flutter pub get
- name: Build iOS run: flutter build ios --release --no-codesign
- name: Create IPA run: flutter build ipa --releaseCollecting Flutter Build Artifacts
Section titled “Collecting Flutter Build Artifacts”You can collect build outputs from your Flutter builds:
name: Flutter Build with Artifactsplatform: flutter
environment: flutter: "3.24.0"
triggers: - push
steps: - name: Install dependencies run: flutter pub get
- name: Build iOS run: flutter build ios
- name: Build Android run: flutter build apk
artifacts: - build/ios/iphoneos/**/*.app - build/ios/archive/**/*.xcarchive - build/app/outputs/**/*.apk