PlaceholderResolver class abstract interface

Strategy interface for resolving placeholder values in configuration strings.

A PlaceholderResolver is typically used in systems like property resolvers, YAML or .properties processors, and templating engines to resolve values like #{host} or #{user.name}.

If the placeholder cannot be resolved, this interface allows returning null to indicate that no replacement is to be made.

Example

class MapPlaceholderResolver implements PlaceholderResolver {
  final Map<String, String> values;

  MapPlaceholderResolver(this.values);

  @override
  String? resolvePlaceholder(String placeholderName) => values[placeholderName];
}

final resolver = MapPlaceholderResolver({'port': '8080'});
print(resolver.resolvePlaceholder('port')); // 8080
Implementers

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolvePlaceholder(String placeholderName) String?
Strategy interface for resolving placeholder values in configuration strings.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited