ANN Flutter Flavor — Fastlane Plugin
Fastlane plugin that reads annspec.yaml and provides lanes for building, signing, uploading and testing all Flutter flavors across Android, iOS and Web — without writing repetitive Fastfile boilerplate for each flavor.
Installation
Add to your Pluginfile:
gem 'ann-flutter-flavor'
Then run:
fastlane add_plugin ann_flutter_flavor
# or
bundle install
Or add directly via Fastlane:
fastlane add_plugin ann_flutter_flavor
Quick start
# Fastfile
lane :deploy_android do
ann_compile_build(platform: :android, build_config: "release")
ann_upload_to_play_store(platform: :android)
end
lane :deploy_ios do
ann_compile_build(platform: :ios, build_config: "release")
ann_upload_to_app_store(platform: :ios)
end
Run a lane:
bundle exec fastlane deploy_android
bundle exec fastlane deploy_ios
Actions
ann_compile_build — Build all flavors for a platform
Builds every flavor defined in annspec.yaml for a given platform. Supports building a subset of flavors via the flavor parameter.
ann_compile_build(
platform: :android, # :ios, :android, or :web
build_config: "release", # "debug", "profile", "release"
sub_command: "appbundle", # "apk", "appbundle", "ipa", "web"
flavor: "production", # Comma-separated. Omit to build ALL flavors
clean: false, # Run flutter clean before building
main_file: "lib/main.dart", # Default main file (overridden per-flavor in spec)
skip_sound_null_safety: false,
skip_code_sign: false,
export_options_plist: "", # iOS only — path to ExportOptions.plist
additional_parameter: "", # Extra flutter build flags
spec_file: nil # Custom path to annspec.yaml (optional)
)
Examples:
# Build all Android flavors
ann_compile_build(platform: :android)
# Build specific iOS flavors only
ann_compile_build(platform: :ios, flavor: "production,staging", build_config: "release")
# Build web with clean
ann_compile_build(platform: :web, sub_command: "web", clean: true)
ann_upload_to_play_store — Upload Android to Google Play
Builds and uploads all Android flavors to the Google Play Store using the google_api_key defined in annspec.yaml.
ann_upload_to_play_store(
flavor: "production", # Specific flavor(s). Omit for all
clean: false,
spec_file: nil
)
ann_upload_to_app_store — Upload iOS to App Store
Builds and uploads all iOS flavors to the Apple App Store using the apple_api_key and export_options_plist defined in annspec.yaml.
ann_upload_to_app_store(
flavor: "production", # Specific flavor(s). Omit for all
clean: false,
spec_file: nil
)
ann_upload_to_firebase — Deploy web to Firebase Hosting
Builds and deploys all web flavors to Firebase Hosting.
ann_upload_to_firebase(
flavor: "web", # Specific flavor(s). Omit for all
clean: false,
spec_file: nil
)
ann_run_tests — Run integration tests
Runs integration tests for all flavors of a given platform using emulators/simulators.
ann_run_tests(
platform: :android, # :ios or :android
test_spec_file: nil # Path to test spec YAML (optional)
)
ann_open_emulators — Start emulators/simulators
Opens the required emulators or simulators for a platform before running tests.
ann_open_emulators(
platform: :android,
test_spec_file: nil
)
annai_upgrade_setup — Maintenance setup
Runs comprehensive Flutter and Fastlane maintenance: flutter upgrade, flutter doctor, bundle update, gem install.
annai_upgrade_setup # Skip if already up to date
annai_upgrade_setup(force: true) # Force run regardless
annai_cleanup — Clean build artifacts
Runs flutter clean and removes platform build folders.
annai_cleanup
annai_cleanup(force: true)
Configuration
The plugin reads annspec.yaml from your Flutter project root. Keys used by Fastlane actions:
annai_app:
android:
default:
fastlane:
google_api_key: "../annai_app_data/keys/android/google-api-key.json"
flavor:
production:
main_file: "lib/flavors/main_prod.dart"
version_name: 2.1.0
version_code: 20100
ios:
default:
fastlane:
apple_api_key: "../annai_app_data/keys/ios/apple_api_key.json"
export_options_plist: "../annai_app_data/keys/ios/exportOptions.plist"
flavor:
production:
apple_id: "1234567890" # Required for App Store upload
main_file: "lib/flavors/main_prod.dart"
version_name: 2.1.0
version_code: 20100
See the Gradle plugin README for the complete annspec.yaml field reference.
Typical CI/CD Fastfile
default_platform(:android)
platform :android do
lane :build do
ann_compile_build(
platform: :android,
build_config: "release",
sub_command: "appbundle",
clean: true
)
end
lane :deploy do
ann_upload_to_play_store
end
lane :test do
ann_open_emulators(platform: :android)
ann_run_tests(platform: :android)
end
end
platform :ios do
lane :build do
ann_compile_build(
platform: :ios,
build_config: "release",
sub_command: "ipa"
)
end
lane :deploy do
ann_upload_to_app_store
end
end
Requirements
- Fastlane
>= 2.232.2 - Ruby
>= 3.0 - Flutter project with
annspec.yamlat the project root
Related plugins
- android-build-flavorize — Gradle plugin for Android build configuration
- android-studio-flavorize — Android Studio plugin for interactive spec sync