dotenv 0.1.1+1 copy "dotenv: ^0.1.1+1" to clipboard
dotenv: ^0.1.1+1 copied to clipboard

outdatedDart 1 only

Load environment variables from a `.env` file.

dotenv #

Load environment variables at runtime from a .env file.

Pub Version Build Status

NB: Travis uses test_runner, which has not yet moved off unittest.

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 #

Variable substitution and character escaping is a work in progress. Some cases don't work yet. 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