java-james / flutter_dotenv

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

Fixed a warning when using with flutter_test #3

Closed 10ndavis closed 4 years ago

10ndavis commented 4 years ago

Shell: [flutter_dotenv] No env values found. Make sure you have called DotEnv.load()

I believe this is because when doing env.addAll(psr.parse(lines)); inside the load method in dotenv.dart, it is using env as a getter, which is originally empty, as it is not yet set. Then, it is setting the value using the setter.

After the change, the message no longer shows and the env is still returned as expected.

image

This is how I am using flutter_dotenv in the test to replicate.

tewshi commented 4 years ago

you made the exact change I wanted to make.

tewshi commented 4 years ago

👍 this warning also shows on iOS, at all times, test, debug, production.

java-james commented 4 years ago

Thanks for the PR! I will review this shortly.

java-james commented 4 years ago

Thank you for the PR. I will so a release to pub with the change too.

10ndavis commented 4 years ago

You bet!

java-james commented 4 years ago

Released as 2.0.3 🚀 Cheers!

tewshi commented 4 years ago

great...