Problem
I'm trying to save a few CLI arguments into a variable, so it's convenient for me to use later. This works but is quite verbose:
- flutter run --dart-define=SENTRY_DSN_CLIENT_KEY=${APP1_SENTRY_DSN_CLIENT_KEY} --dart-define=MAPBOX_ACCESS_TOKEN=${APP1_MAPBOX_ACCESS_TOKEN}
Unfortunately, neither of the following, concise options work. The 2nd --dart-define is not available in the app. I've tried:
- flutter run $APP1_DART_DEFINE_FLAGS
- flutter run "${APP1_DART_DEFINE_FLAGS[@]}"
How do I workaround an issue which seems to be inside the flutter run tool?
Related problems
This seems to be highly related to (but I don't have control over fixing this):
- Documented as SC2128: Expanding an array without an index only gives the first element.
- in SO question
My env file
export APP1_SENTRY_DSN_CLIENT_KEY=...
export APP1_MAPBOX_ACCESS_TOKEN=...
export APP1_DART_DEFINE_FLAGS="--dart-define=SENTRY_DSN_CLIENT_KEY=${APP1_SENTRY_DSN_CLIENT_KEY} --dart-define=MAPBOX_ACCESS_TOKEN=${APP1_MAPBOX_ACCESS_TOKEN}"
 
     
    