call<T> method
Returns a T
typed value or null
.
Example:
final debug = config('app.debug'); // Read the { "app": { "debug": <value> } }
Implementation
T? call<T>(String keys) {
final cleanedKeys = keys.trimDots();
final result = dotOperator<T>(_storage, cleanedKeys);
if (result != null) return result;
Object? value;
for (final preset in _loaders.reversed) {
final result = preset.fallback(cleanedKeys);
if (result is T) return result;
if (result != null) value = result;
}
if (value != null) {
return warnTypeCast(cleanedKeys, value, shouldWarn(_storage));
}
return null;
}