DefaultPropertiesPropertySource class
A specialized MapPropertySource representing a default set of properties that can be added to or merged with an existing Environment.
The source is always named "defaultProperties" and is often used as a
fallback or baseline configuration layer.
This property source supports convenient static utility methods for checking names, conditionally creating sources, merging into existing sources, and repositioning it within the property source list.
Example:
final defaults = {
'app.name': 'JetLeaf',
'app.debug': false,
};
DefaultPropertiesPropertySource.ifNotEmpty(defaults, (p) {
environment.propertySources.addFirst(p);
});
- Inheritance
-
- Object
- PropertySource<
Map< String, Object> > - MapPropertySource
- DefaultPropertiesPropertySource
Constructors
-
DefaultPropertiesPropertySource(Map<
String, Object> source) - A specialized MapPropertySource representing a default set of properties that can be added to or merged with an existing Environment.
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
Static Methods
-
addOrMerge(
Map< String, Object> source, MutablePropertySources sources, [String? name]) → void -
Adds a new DefaultPropertiesPropertySource to
sourcesor merges the givensourcewith an existing one named"defaultProperties". -
hasMatchingName(
PropertySource? propertySource) → bool -
Returns
trueif the givenpropertySourceis named"defaultProperties". -
ifNotEmpty(
Map< String, Object> source, Consumer<DefaultPropertiesPropertySource> ? action) → void -
Invokes
actionwith a new DefaultPropertiesPropertySource if the providedsourcemap is not empty. -
mergeIfPossible(
Map< String, Object> source, MutablePropertySources sources, Map<String, Object> resultingSource, String name) → void -
Internal helper that attempts to merge
sourceinto the existing"defaultProperties"property source insidesources. -
moveSourcesToEnd(
MutablePropertySources propertySources, [String? name]) → void -
Moves the
"defaultProperties"source to the end of thepropertySourcescollection, preserving its values but placing it last in resolution order. -
moveSourcesToStart(
MutablePropertySources propertySources, [String? name]) → void -
Moves the
"defaultProperties"source to the start of thepropertySourcescollection, preserving its values but placing it last in resolution order. -
moveToEnd(
ConfigurableEnvironment environment, [String? name]) → void -
Moves the
"defaultProperties"source to the end of the givenenvironment's property sources list. -
moveToStart(
ConfigurableEnvironment environment, [String? name]) → void -
Moves the
"defaultProperties"source to the start of the givenenvironment's property sources list.