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

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 true if this property source contains a value for the given property name.
inherited
equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
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, or null if 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 sources or merges the given source with an existing one named "defaultProperties".
hasMatchingName(PropertySource? propertySource) bool
Returns true if the given propertySource is named "defaultProperties".
ifNotEmpty(Map<String, Object> source, Consumer<DefaultPropertiesPropertySource>? action) → void
Invokes action with a new DefaultPropertiesPropertySource if the provided source map is not empty.
mergeIfPossible(Map<String, Object> source, MutablePropertySources sources, Map<String, Object> resultingSource, String name) → void
Internal helper that attempts to merge source into the existing "defaultProperties" property source inside sources.
moveSourcesToEnd(MutablePropertySources propertySources, [String? name]) → void
Moves the "defaultProperties" source to the end of the propertySources collection, preserving its values but placing it last in resolution order.
moveSourcesToStart(MutablePropertySources propertySources, [String? name]) → void
Moves the "defaultProperties" source to the start of the propertySources collection, 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 given environment's property sources list.
moveToStart(ConfigurableEnvironment environment, [String? name]) → void
Moves the "defaultProperties" source to the start of the given environment's property sources list.