ConfigurationPropertySource mixin
A mixin that provides access to a globally attached Environment.
This is typically used by configuration classes that need to resolve properties without explicitly passing around the Environment instance.
The environment must first be attached with attach before attempting to access it through the environment getter.
Example:
void main() {
final env = Environment();
ConfigurationPropertySource.attach(env);
final config = MyConfig(); // uses ConfigurationPropertySource
print(config.environment.getProperty("app.name"));
}
⚠️ If environment is accessed before calling attach, an error will be thrown.
- Mixin applications
Properties
- environment → Environment
-
Returns the globally attached Environment.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Methods
-
attach(
Environment environment) → void - Attaches a global Environment instance to this property source.