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

outdated

Load environment variables from a `.env` file.

example/example.dart

import 'dart:io';

import 'package:dotenv/dotenv.dart';

void main() {
  var env = DotEnv(includePlatformEnvironment: true)..load();

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

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

  env.clear();
  p('cleared!');

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

p(String msg) => stdout.writeln(msg);
114
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

args, meta

More

Packages that depend on dotenv