sha_env 3.0.0 copy "sha_env: ^3.0.0" to clipboard
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);
}
1
likes
150
points
12
downloads

Documentation

API reference

Publisher

verified publisherprojetretro.io

Weekly Downloads

Yet another DotEnv handling library for Dart but all the other gave me headaches.

Homepage
Repository (GitLab)
View/report issues

Topics

#env #environment #configuration

License

unknown (license)

Dependencies

meta, path

More

Packages that depend on sha_env