configurable/lib/dotenv_configuration_provider.dart
Sambo Chea 33b6355bcf Add configurable with functions
Add more tests for call functions and fixed
2021-03-24 14:10:25 +07:00

25 lines
508 B
Dart

import 'package:configurable/configuration_provider.dart';
import 'package:configurable/dotenv/dotenv.dart' show env, load;
class DotenvConfigurationProvider implements ConfigurationProvider {
DotenvConfigurationProvider() {
load();
}
@override
bool containsKey(String key) {
return env.containsKey(key);
}
@override
String? getOrNull(String key, {String? defaultValue}) {
var value = env[key];
if (value == null) {
return defaultValue;
}
return value;
}
}