Skip to content

Instantly share code, notes, and snippets.

@drkdelaney
Created May 13, 2025 18:19
Show Gist options
  • Save drkdelaney/80d26d43704524643203a94e4c01112f to your computer and use it in GitHub Desktop.
Save drkdelaney/80d26d43704524643203a94e4c01112f to your computer and use it in GitHub Desktop.
#! /bin/zsh
# configuring multiple flutter project for flavors
# add list of flavors here, keep all list the same length
flavors=(prod stg dev)
# add firebase project names here
project=(myapp-prod myapp-stg myapp-dev)
# add package names here
bundleName=(com.example.prod com.example.stg com.example.dev)
# get length of an array
arraylength=${#flavors[@]}
# use for loop to read all values and indexes
for (( i=0; i<${arraylength}; i++ ));
do
flutterfire configure \
--yes \
--platforms=ios,android,web \
--project=${project[$i]} \
--out=lib/firebase_options/firebase_options_${flavors[$i]}.dart \
--ios-bundle-id=${bundleName[$i]} \
--ios-build-config=Debug-${flavors[$i]} \
--ios-out=ios/flavors/${flavors[$i]}/GoogleService-Info.plist \
--android-package-name=${bundleName[$i]} \
--android-out=android/app/src/${flavors[$i]}/google-services.json && \
flutterfire configure \
--yes \
--platforms=ios,android,web \
--project=${project[$i]} \
--out=lib/firebase_options/firebase_options_${flavors[$i]}.dart \
--ios-bundle-id=${bundleName[$i]} \
--ios-build-config=Release-${flavors[$i]} \
--ios-out=ios/flavors/${flavors[$i]}/GoogleService-Info.plist \
--android-package-name=${bundleName[$i]} \
--android-out=android/app/src/${flavors[$i]}/google-services.json
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment