cubetiq_dart_shared/lib/src/configurable/configuration_provider.dart
Sambo Chea 7ec5118598 Task: Add text formatter functions and updated for configurable from the latest
functions with future and async support and add tests and examples
2021-06-01 23:03:54 +07:00

22 lines
626 B
Dart

/// Configuration Provider
///
/// @author sombochea
/// @since 1.0.0
abstract class ConfigurationProvider {
/// check has key or not in implemented classes
bool containsKey(String key);
/// get or null in implemented classes
String? getOrNull(String key, {String? defaultValue});
/// check has key or not for async function
Future<bool> containsKeyAsync(String key) async {
return Future.value(containsKey(key));
}
/// get or null for async function
Future<String?> getOrNullAsync(String key, {String? defaultValue}) async {
return Future.value(getOrNull(key, defaultValue: defaultValue));
}
}