dotenv 0.1.0 copy "dotenv: ^0.1.0" to clipboard
dotenv: ^0.1.0 copied to clipboard

outdatedDart 1 only

Load environment variables from a `.env` file.

dotenv #

Load environment variables at runtime from a .env file.

usage #

Prefix the library import and call load(), exposing the env map with a top-level getter.

import 'package:dotenv/dotenv.dart' as dotenv;

Map<String, String> get _env => dotenv.env;

void main() {
  dotenv.load();
  var x = _env['foo'];
  // ...
}

Verify required variables are present:

const _requiredEnvVars = const ['host', 'port'];

bool get hasEnv => dotenv.isEveryDefined(_requiredEnvVars);

limitations #

Does not yet support escaping or substitution. Pull requests gleefully considered.

prior art
113
likes
0
pub points
96%
popularity

Publisher

verified publisherpracticalflutter.com

Load environment variables from a `.env` file.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

logging

More

Packages that depend on dotenv