dotenv 0.1.3+2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • --

dotenv #

Load environment variables at runtime from a .env file.

Pub Version Build Status Documentation

usage #

See documentation.

cli #

Get the latest:

$ pub global activate dotenv

Run:

$ pub global run dotenv:new  # create a `.env` file and add it to `.gitignore`
$ pub global run dotenv      # load the file and print the environment to stdout

limitations #

Variable substitution and character escaping is a work in progress. Some cases don't work yet. Pull requests gleefully considered.

prior art #

changelog #

This project follows pub-flavored semantic versioning. (more)

Release notes are available on github.

0.1.3+2 #

  • [fix] don't throw if load fails #11

0.1.3+1 #

  • [fix] allow braces with ${var} substitution #10

0.1.3 #

  • [new] add command-line interface #7, #8
  • [deps] add args@v0.13

0.1.2 #

  • [new] support variable substitution from Platform.environment #6
  • [deps] drop logging

0.1.1+2 #

  • [fix] don't strip # inside quotes #5

0.1.1+1 #

  • [fix] whitespace causes quotes not to be stripped

0.1.1 #

  • [deprecated] Parser internals will become private. #3
    • #unquote, #strip, #swallow, #parseOne, #surroundingQuote, #interpolate
  • [new] support variable substitution
  • [deps] migrate to test
  • [deps] bump logging

0.1.0 #

Initial release.

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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dotenv: ^0.1.3+2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dotenv/dotenv.dart';
  
Version Uploaded Documentation Archive
1.0.0 Jul 12, 2018 Go to the documentation of dotenv 1.0.0 Download dotenv 1.0.0 archive
0.1.3+3 Jul 19, 2015 Go to the documentation of dotenv 0.1.3+3 Download dotenv 0.1.3+3 archive
0.1.3+2 Jun 5, 2015 Go to the documentation of dotenv 0.1.3+2 Download dotenv 0.1.3+2 archive
0.1.3+1 May 15, 2015 Go to the documentation of dotenv 0.1.3+1 Download dotenv 0.1.3+1 archive
0.1.3 May 15, 2015 Go to the documentation of dotenv 0.1.3 Download dotenv 0.1.3 archive
0.1.2 May 12, 2015 Go to the documentation of dotenv 0.1.2 Download dotenv 0.1.2 archive
0.1.1+2 May 10, 2015 Go to the documentation of dotenv 0.1.1+2 Download dotenv 0.1.1+2 archive
0.1.1+1 May 10, 2015 Go to the documentation of dotenv 0.1.1+1 Download dotenv 0.1.1+1 archive
0.1.1 May 10, 2015 Go to the documentation of dotenv 0.1.1 Download dotenv 0.1.1 archive
0.1.0 Apr 7, 2015 Go to the documentation of dotenv 0.1.0 Download dotenv 0.1.0 archive

All 11 versions...

Awaiting analysis to complete.