I am trying to pass arguments using --dart-define in the Android Studio IDE, but I am not able to access in the code.
code is
String.fromEnvironment('ENVIRONMENT', defaultValue: "DEV");
It is returning defaultValue.
I am trying to pass arguments using --dart-define in the Android Studio IDE, but I am not able to access in the code.
code is
String.fromEnvironment('ENVIRONMENT', defaultValue: "DEV");
It is returning defaultValue.
This is probably a weird gotcha with String.fromEnvironment
, from the docs:
This constructor is only guaranteed to work when invoked as const
So this only works if you use
const String.fromEnvironment('ENVIRONMENT', defaultValue: "DEV");
change this
--dart-define=ENVIRONMENT=PROD
to this
--dart-define ENVIRONMENT=PROD