sha_env 3.0.0
sha_env: ^3.0.0 copied to clipboard
Yet another DotEnv handling library for Dart but all the other gave me headaches.
example/sha_env_example.dart
import 'dart:io';
import 'package:sha_env/sha_env.dart';
void main(final List<String> args) async {
/// Load the environment variables from a file.
await load(path: '.env.test');
/// Check if the environment variable exists.
if (has('STRING')) {
print('The environment variable STRING exists.');
} else {
print('The environment variable STRING does not exist.');
}
/// Get the value of the environment variable.
final string = getString('STRING');
print('The value of the environment variable STRING is $string.');
/// Print all the environment variables.
env.forEach((final k, final v) => print('$k: $v'));
exit(0);
}