You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--dart-define variables are accesible in gradle with project.property('dart-defines') , and on iOS via ios/Flutter/Generated.xcconfig this could potentially be an alternative to using a .env file, as --dart-define variables are more easily accesible on the flutter engine with String.fromEnvironment("MY_VAR") and int.fromEnvironment("MY_VAR")
Simple script in gradle to make dart-define variables into a map
function urldecode() { : "${*//+/ }"; echo "${_//%/\\x}"; }
IFS=',' read -r -a define_items <<< "$DART_DEFINES"
for index in "${!define_items[@]}"
do
define_items[$index]=$(urldecode "${define_items[$index]}");
done
printf "%s\n" "${define_items[@]}" > ${SRCROOT}/Flutter/Dart-defines.xcconfig
Things to note:
This will not be a replacement, but an alternative. Users can either chose to use a .env file or --dart-define
If both .env and --dart-define are used, the map for .env variables will be created first and the --dart-define variables will be appended.
The text was updated successfully, but these errors were encountered:
--dart-define
variables are accesible in gradle withproject.property('dart-defines')
, and on iOS viaios/Flutter/Generated.xcconfig
this could potentially be an alternative to using a.env
file, as--dart-define
variables are more easily accesible on the flutter engine withString.fromEnvironment("MY_VAR")
andint.fromEnvironment("MY_VAR")
Simple script in gradle to make
dart-define
variables into a mapSimple Build pre-action script for xcode
Things to note:
.env
file or--dart-define
.env
and--dart-define
are used, the map for.env
variables will be created first and the--dart-define
variables will be appended.The text was updated successfully, but these errors were encountered: