flutter_dotenv icon indicating copy to clipboard operation
flutter_dotenv copied to clipboard

How to add env variables in the command line

Open arualana opened this issue 5 years ago • 2 comments

Hello, I am trying to set the variables in the command line

I am running

flutter run -d chrome

How do I add the env variables to the command?

arualana avatar Oct 07 '20 00:10 arualana

any news?

GorinMaxim avatar Oct 14 '23 10:10 GorinMaxim

I stumbled upon this myself, but later discovered that Flutter or Dart has built-in command that loads environment variable values:

flutter run --dart-define=baseUrl=https://github.com/

or file:

flutter run --dart-define-from-file=.env

Please see: https://itnext.io/secure-your-flutter-project-the-right-way-to-set-environment-variables-with-compile-time-variables-67c3163ff9f4

hpelitebook745G2 avatar Feb 20 '24 17:02 hpelitebook745G2