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

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
name String
The unique name that identifies this property source. Typically used for logging, debugging, and source resolution order.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source Map<String, Object>
The underlying object that holds the raw property data.
finalinherited

Methods

containsProperty(String name) bool
Returns true if this property source contains the given name.
inherited
equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
inherited
getName() String
Returns the name of this property source.
inherited
getProperty(String name) Object?
Retrieves the value associated with the given name, or null if not present.
inherited
getSource() Map<String, Object>
Returns the underlying source object.
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