env_provider 0.2.0
env_provider: ^0.2.0 copied to clipboard
Env Provider is an all in one utility for interacting with the environment and will never throw and exception.
Env Provider #
Env Provider is an all in one utility for interacting with the environment and will never throw and exception.
Usage #
Platform Directories #
Env Provider is safe super-set of path_provider. As such, all
methods of path_provider can be accessed from Env
. e.g
Result<Directory, DirectoryRetrievalError> docsDir = await Env.getApplicationDocumentsDirectory();
Get Current Directory #
String currentDir = Env.currentDirectory();
Get the Executable Path #
String exePath = Env.currentExe();
Get an Environment Variable #
String? variable = Env.variable('HOME');
Join Paths #
String path = Env.joinPaths(['/usr/local/bin', '/usr/bin', '/bin']);
print(path); // '/usr/local/bin:/usr/bin:/bin'
List All Environment Variables #
for (var (variable, value) in Env.variables()) {
print('$variable: $value');
}