I'm developing a Flutter application with different product flavors for Android and want to be able to define a value for each flavor, and select the value based on which flavor I'm building, and interpolate it into a properties file in order to dynamically configure a third party library. I would also be open to having multiple duplicate properties files, each with their flavor-specific values, and then selecting the right one at build time.
My research suggests I'm likely taking the wrong approach. After reading the Android documentation, I tried using BuildConfig to generate the values and then reference them in the properties file. I do see that the BuildConfig.java is built with the right values, but they are not being interpolated in my properties file. I'm not sure what approach I should be taking here, so any suggestions would be great!
thirdPartyLibrary.properties
customProperty=${BuildConfig.CUSTOM_PROPERTY}
build.gradle
...
flavorDimensions "app"
productFlavors {
dev {
dimension "app"
buildConfigField "String", "CUSTOM_PROPERTY", "\"my custom property for dev\""
}
qa {
dimension "app"
buildConfigField "String", "CUSTOM_PROPERTY", "\"my custom property for qa\""
}
}
...