SystemEnvironmentPropertySource constructor
A MapPropertySource that exposes system environment variables as a property source.
This class wraps a Map<String, String> of environment variables, typically obtained
from Platform.environment
, and exposes it through the property resolution system.
This allows the environment to be queried like any other configuration source, with consistent property access patterns.
Example usage:
import 'dart:io';
final envSource = SystemEnvironmentPropertySource('systemEnv', Platform.environment);
print(envSource.getProperty('HOME')); // e.g. /Users/yourname
print(envSource.containsProperty('PATH')); // true
Can be added to a MutablePropertySources stack for prioritized resolution.
final sources = MutablePropertySources();
sources.addLast(envSource);
Implementation
SystemEnvironmentPropertySource(String name, Map<String, String> systemEnv) : super(name, Map.from(systemEnv));