penv
.env loader for Dart

Contributing

Bug reports, feature requests, and pull requests are all welcome on GitHub.

Reporting a bug

Include the penv version, a minimal .env snippet that reproduces the issue, and what you expected vs. what you got. Don’t include real secrets from your own .env file in a public issue — replace them with placeholders that still trigger the bug.

Working on the code

git clone https://github.com/psdkjoon/penv.git
cd penv
dart pub get
dart test

The whole package is four small files under lib/src/: penv.dart (the loading functions), parser.dart (line-by-line .env parsing), extensions.dart (typed accessors), and exception.dart.

Style

  • Every public member gets a /// doc comment — this site’s API Reference is generated from them.
  • Parsing changes belong in parser.dart’s parseEnvLines/_expandVariables/_unescapeDoubleQuoted — keep penvload/penvloadOrNull/penvloadAsync as thin wrappers around it so all three variants stay in sync.
  • New examples go in example/, following the existing files’ plain, comment-driven style.

Before opening a PR

dart format --set-exit-if-changed .
dart analyze
dart test