ListablePropertySource<T>.named constructor
ListablePropertySource<T>.named (
- String name
A specialized PropertySource capable of enumerating all available property keys, allowing efficient lookup operations.
Unlike generic property sources, this class supports retrieval of all known property names through getPropertyNames. This makes methods like containsProperty fast and lightweight, as they can check membership without calling getProperty.
Framework-level sources like environment variables, maps, or configuration files often extend this class to benefit from key enumeration.
Example:
class MapPropertySource extends ListablePropertySource<Map<String, Object>> {
MapPropertySource(super.name, super.source);
@override
List<String> getPropertyNames() => source.keys.toList();
@override
Object? getProperty(String name) => source[name];
}
Implementation
ListablePropertySource.named(super.name) : super.named();