maanick90
maanick90

Reputation: 133

Testing Flutter iOS app with multiple main_<env>.dart in TestFlight

I am a newbie to mobile progamming. I am developing a free iOS app in Flutter and my code is ready to be tested on my DEV/Test environment before I deploy to AppStore (Prod environment). Each of these environments connects to different backend APIs, and they have different Firebase configurations.

So, I have created three main.dart files, namely main_dev, main_test, main_prod.dart. main.dart does not have the void main() function but it contains common code to be shared.

I am using flavors and the target path argument to run the respective environment locally. Eg. flutter run --flavor dev -t lib/main_dev.dart and similarly for Test environment.

Xcode: I have created Schemes in Xcode that point to each flavor. I have set up the configurations, Firebase Run script to copy the correct GoogleService-Info.plist before each build, and I tested them locally for both DEV and Test environment.

However, I want to install my apps on my friends' mobile devices and test them in the Test environment. I tried to use TestFlight where I uploaded my archive from the test scheme. For test flavor/scheme, main_test.dart should be called. I don't find an option to pass the argument -t lib/main_test.dart in Xcode/TestFlight. How can I achieve this?

Is there a way in TestFlight where I can upload and test my code to connect to Test configurations and when I release them to the App Store, connect to Prod configurations.

Your answers would be really helpful for a newbie like me! Thanks!

Upvotes: 3

Views: 1926

Answers (1)

Daksh Gargas
Daksh Gargas

Reputation: 3943

Select Runner ->

Navigate to BuildSettings ->

Search for FLUTTER_TARGET and define your files there.

enter image description here

Upvotes: 6

Related Questions