When you run a Flutter integration test, the framework launches your app. I would like to pass some configuration values (e.g. backend API URLs) to the app to use when it starts up. There aren't a fixed set of configuration values, for example, the backend URL is different for each branch in version control, and we run our tests against each branch.
I looked at Flutter's flavours, but seems a good solution only when you have a fixed number of variations. Similarly, I can't create a app.dart
file for each possible configuration.
I also looked at whether I could use the DataHandler
argument to enableFlutterDriverExtension
to communicate values from the test code (which could then itself read them from environment variables), but I'd really want to use these configuration values to build the app when it first launches.
Is there a more straightforward way to do this in Flutter?