dotenv icon indicating copy to clipboard operation
dotenv copied to clipboard

use in test flutter charge enviroments?

Open dcortesnet opened this issue 5 years ago • 3 comments

dcortesnet avatar Oct 10 '19 03:10 dcortesnet

Any idea about how to use this with Unit tests. I am getting file not found

raheelriax avatar Dec 07 '19 22:12 raheelriax

You can set env variables before running tests using dot env like this

DotEnv().env = {"yourEnvVar": value};
DotEnv().env["yourEnvVar"] ///value

raheelriax avatar Dec 13 '19 18:12 raheelriax

New syntax for setting up your test environment: dotenv.testLoad(mergeWith: {"KEY": "value"});

Then you can load a variable like this: dotenv.env["KEY"]!

jtmuller5 avatar Feb 07 '22 22:02 jtmuller5