2

I'm trying to run my flutter integration tests on firebase test lab. Therefore I'm using dart environment variables to set my login credentials. To setup the ios test version I need to run the following command:

xcodebuild -workspace Runner.xcworkspace -scheme Runner -config Flutter/Release.xcconfig -derivedDataPath ../build/ios_integ -sdk iphoneos build-for-testing

My question is now how to set the dart environment variables in this command? On the android gradle task it works when I pass the variable as base64 string -Pdart-defines="${BASE64_STRING}". But that doesn't work for me on iOS.

Dix20
  • 178
  • 2
  • 8

1 Answers1

0

Run flutter build ios in config-only mode passing your dart defines:

flutter build ios --config-only -t integration_test/example_test.dart --debug --dart-define MY_KEY=MY_VALUE

If it succeeds, you should be able to see your dart defines in Flutter/Generated.xcconfig file (encoded in base64):

$ cat ios/Flutter/Generated.xcconfig | grep DART_DEFINES
DART_DEFINES=TVlfS0VZPU1ZX1ZBTFVF
$ printf 'TVlfS0VZPU1ZX1ZBTFVF' | base64 -d
MY_KEY=MY_VALUE

If you do xcodebuild build-for-testing now, the dart defines will be compiled into your app.

Bartek Pacia
  • 1,085
  • 3
  • 15
  • 37