MapPropertySource class

A PropertySource implementation backed by a Map of key-value pairs.

This class allows accessing properties from an in-memory map, making it suitable for programmatically defined configurations such as application defaults, test configurations, or runtime-supplied settings.

It supports property lookup via containsProperty and getProperty.

Example usage:

final config = {
  'app.name': 'JetLeaf',
  'app.port': 8080,
};

final propertySource = MapPropertySource('defaultConfig', config);

print(propertySource.containsProperty('app.name')); // true
print(propertySource.getProperty('app.port')); // 8080

This can be added to a MutablePropertySources collection for use with a PropertySourcesPropertyResolver.

Inheritance
Implementers

Constructors

MapPropertySource(String name, Map<String, Object> source)
A PropertySource implementation backed by a Map of key-value pairs.

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.
override
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.
override
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