Sambo Chea
649f25b265
- Split tests file - Fixed and nullable functions - Able to set or remove config from system config
31 lines
696 B
Dart
31 lines
696 B
Dart
import 'package:configurable/configuration_provider.dart';
|
|
import 'package:configurable/dotenv/dotenv.dart' show env, load;
|
|
|
|
/// Dotenv Configuration Provider
|
|
///
|
|
/// @author sombochea
|
|
/// @since 1.0.0
|
|
class DotenvConfigurationProvider implements ConfigurationProvider {
|
|
/// default constructor to load the platform environment
|
|
DotenvConfigurationProvider() {
|
|
load();
|
|
}
|
|
|
|
@override
|
|
bool containsKey(String key) {
|
|
return env.containsKey(key);
|
|
}
|
|
|
|
@override
|
|
String? getOrNull(String key, {String? defaultValue}) {
|
|
var value = env[key];
|
|
|
|
/// if value is null, then return default value
|
|
if (value == null) {
|
|
return defaultValue;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
}
|