How to use "--dart-define=" in Flutter test

Viewed 1835

I'm using flutter test with --dart-define option as follows:

# code to run the test
flutter test --machine --start-paused --plain-name "" --dart-define=SOMEENVVAR=123 test/rovaf_client_test.dart

but the problem is that I can't use this environment variable as follows:

print(String.fromEnvironment("SOMEENVVAR"));

this just prints out nothing.

Is there any way to use environment variable or pass parameters for flutter run test command? Thanks!

1 Answers
Related