SystemEnvironmentPropertySource class
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);
- Inheritance
-
- Object
- PropertySource<
Map< String, Object> > - MapPropertySource
- SystemEnvironmentPropertySource
Constructors
-
SystemEnvironmentPropertySource(String name, Map<
String, String> systemEnv) - A MapPropertySource that exposes system environment variables as a property source.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
containsProperty(
String name) → bool -
Returns
trueif this property source contains a value for the given propertyname.inherited -
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString.inherited -
getName(
) → String -
Returns the unique, human-readable name of this property source.
inherited
-
getProperty(
String name) → Object? -
Retrieves the value associated with the given property
name, ornullif the property is not present in this source.inherited -
getSource(
) → Map< String, Object> -
Returns the underlying source object from which property data is retrieved.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited