java-james / flutter_dotenv

Loads environment variables from `.env`.
https://pub.dartlang.org/packages/flutter_dotenv
MIT License
213 stars 48 forks source link

How to add env variables in the command line #19

Open arualana opened 3 years ago

arualana commented 3 years ago

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?

GorinMaxim commented 11 months ago

any news?

hpelitebook745G2 commented 7 months ago

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