flutter_dotenv icon indicating copy to clipboard operation
flutter_dotenv copied to clipboard

Placement of multiple .envs

Open alexw92 opened this issue 1 year ago • 2 comments

Suppose I have .env.dev and .env.prod, where would i put them if I want to include only the prod env in a production bundle? The example places the .env file in assets but arent all assets part of build bundle? It would be cool if there was an example for dealing with multiple envs storing all of them in the same location. Maybe it is super obvious, in that case I am sorry to ask

alexw92 avatar May 20 '24 21:05 alexw92

I have the same issue. @alexw92, did you find a fix for this?

Sandakan avatar May 06 '25 12:05 Sandakan

If i defined my env files in the pubspec.yaml file like this,

  assets:
    - .env.development
    - .env.testing
    - .env.production

And when I run dart run build_runner build, Fluttergen generates incorrect code. It may be a bug in Fluttergen. I'm not sure.

Image

Sandakan avatar May 06 '25 13:05 Sandakan