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

Load environment variables from a `.env` file.

example/example.dart

import 'dart:io';

import 'package:dotenv/dotenv.dart' show load, clean, isEveryDefined, env;

void main() {
  load();

  p('read all vars? ${isEveryDefined(['foo', 'baz'])}');

  p('value of foo is ${env['foo']}');
  p('value of baz is ${env['baz']}');
  p('your home directory is: ${env['HOME']}');

  clean();

  p('cleaned!');
  p('env has key foo? ${env.containsKey('foo')}');
  p('env has key baz? ${env.containsKey('baz')}');
  p('your home directory is still: ${env['HOME']}');
}

p(String msg) => stdout.writeln(msg);
137
likes
135
points
118k
downloads

Publisher

verified publisherpracticalflutter.com

Weekly Downloads

Load environment variables from a `.env` file.

Repository (GitHub)
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

args, meta

More

Packages that depend on dotenv