env_reader library
A simple utility for reading and parsing environment variables from a .env file
This library provides a way to load environment variables from a .env file and parse them into a Map<String, dynamic>, allowing you to easily access environment values in your Dart application.
Example:
// Loading env data
await Env.load(
EnvFileLoader(File('.env'))
);
// Using env data
String? api = Env.read<String>("API_KEY");
int port = Env.read<int>("PORT") ?? 8080;
bool isDebug = Env.read<bool>("DEBUG") ?? false;
Classes
- Env
- A utility class for reading environment variables from .env source into your dart project.
- EnvFileLoader
- A class to help user load their .env data from File.
-
EnvLoader<
T extends Object> - Used to refering where's the .env file came from.
- EnvMemoryLoader
- A class to help user load their .env data from Uint8List.
- EnvNetworkLoader
- A class to help user load their .env data from network.
- EnvReader
- An instance to load and parse environment variables from .env into dart object.
- EnvStringLoader
- A class to help user load their .env data from String.