dart_dotenv 1.0.1
dart_dotenv: ^1.0.1 copied to clipboard

A simple bridge between dotenv and dartlang.

dart_dotenv

#

A simple and easy to use dotenv library for Dart (dartlang).

Usage #

A simple usage example:

import 'package:dart_dotenv/dart_dotenv.dart';

main(List<String> args) {
  final dotEnv = DotEnv(filePath: '.env');

  // Check if file exists or not.
  print('.env exists ? - ${dotEnv.exists()}');
  // Create a new [filePath] file if not exists.
  print('.env Created New ? - ${dotEnv.createNew()}');
  // Get a specific value from [.env] file.
  print('.env value of "someSpecificKey" ? - ${dotEnv.get("someSpecificKey")}');
  // Get the whole data of [.env] file as [Map<String, String>].
  print('.env data ? - ${dotEnv.getDotEnv()}');
  // Set a new value to and existing key or a completely new set of key and value.
  print('.env append new data ? - ${dotEnv.set("newKey", "newValue")}');
  // Save the new data to `[filePath]` file.
  print('.env save to file ? - ${dotEnv.saveDotEnv()}');
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1
likes
95
pub points
26%
popularity

A simple bridge between dotenv and dartlang.

Repository (GitHub)
View/report issues

Documentation

Documentation (missing)
API reference

License

AGPL-3.0 (LICENSE)

More

Packages that depend on dart_dotenv