I am setting up an Android app that points to a particular Firebase environment based on the build type:
- Debug build -> dev Firebase environment
- Release build -> prod Firebase environment
I followed this guideline and ended up having some productFlavors in my gradle file and stored google-services.json
for both environment in android/app/src/{env}.
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
debuggable true
}
}
flavorDimensions "env"
productFlavors {
dev {
dimension "env"
}
prod {
dimension "env"
}
}
The issue is, now I need to specify --flavor
when running flutter build apk
.
Is there a way to automatically determine the flavor from the build type, e.g., running flutter run
will point to dev, and running flutter run --release
will point to prod?