Load environment variables at runtime from a .env file in Dart
open sourceMITfree
dotenv loads environment variables at runtime from a .env file in Dart, so a development or test environment can mimic production's configuration, the twelve-factor way. It parses the file and can merge its values with Platform.environment. A command-line tool, run with dart pub global run dotenv, creates a .env file and adds it to .gitignore, or prints the file's variables or the whole environment.
Problems it solves
- load config from a .env file in my Dart server or CLI
- keep secrets out of my Dart code in development
- merge .env values with the real environment in Dart
Features
- parses a .env file at runtime
- optionally merges its values with Platform.environment
- CLI to create a .env file and add it to .gitignore
- CLI to print the file's variables or the whole environment
Forks
- flutter_dotenv Load configuration into a Flutter app from a .env file. Its own project.
Alternatives
The same job
These do what dotenv (Dart) does.
- flutter_dotenv Load configuration into a Flutter app from a .env file
