2022-09-23

How to set --dart-define in Xcode

I'm not able to build and launch the app from xcode alone. Meaning pressing the button "Start the active scheme".

I've tried setting the User-Defined setting DART_DEFINES under Build Settings for the different schemes accordingly. E.g.:

DART_DEFINES
  Debug-at     ENV=at
  Debug-dev    ENV=dev

and so on. Picture for clarity:

enter image description here

When trying this, the build fails with the following error:

error build: Command PhaseScriptExecution failed with a nonzero exit code

Am I missing something obvious? Are there other ways of passing command line arguments when building/launching from xcode?

Launching the application on an IOS simulator from VSCode using the following (in launch.json) works fine:

{
    "name": "[dev] myAppName",
    "request": "launch",
    "type": "dart",
    "args": [
        "--dart-define", "ENV=dev",
        "--flavor", "dev"
    ]
}

Running the following command works fine:

flutter build ipa --flavor dev --dart-define "ENV=dev"


No comments:

Post a Comment