petercinibulk / envied

Handles environment variables in dart from a .env file.
MIT License
148 stars 35 forks source link

How to run specific enviornment based on command #91

Closed affansk closed 8 months ago

affansk commented 8 months ago

Hey struggling with running specific enviornment like dev, staging, production.

i have setup exactly as in document , added extra 2 enviornment. i am not geting how will i run other 2 enviornment using command

shanaka-sync commented 7 months ago

I think it is up to us how we use it. Eg:

@Envied(path: '.env.dev') abstract class EnvDev { @EnviedField(varName: 'KEY1') static const key1 = _Env.key1; }

@Envied(path: '.env.prd') abstract class EnvPrd { @EnviedField(varName: 'KEY1') static const key1 = _Env.key1; }

// in your app use kReleaseMode to identify the mode then use EnvDev & EnvPrd accordingly. I hope this should work 😇

affansk commented 7 months ago

@shanaka-sync i drop this.. using dart define from file

techouse commented 7 months ago

i have setup exactly as in document , added extra 2 enviornment. i am not geting how will i run other 2 enviornment using command

Using flavors

a1tem commented 2 months ago

Can be used with flavors and this setup