PropertyPlaceholderHelper constructor
A utility class for resolving string values that contain placeholders
in the format #{name}
.
The placeholder values can be substituted using either a Map<String, String>
or a custom PlaceholderResolverFn.
Example
final helper = PropertyPlaceholderHelper('\#{', '}');
final result = helper.replacePlaceholders('Hello \#{name}!', {'name': 'World'});
print(result); // Output: Hello World!
You can also provide default values or escape characters using the PropertyPlaceholderHelper.more constructor.
Advanced Example
final helper = PropertyPlaceholderHelper.more('\#{', '}', ':', r'\', false);
final result = helper.replacePlaceholders('Welcome \#{user:Guest}', {});
print(result); // Output: Welcome Guest
Creates a new PropertyPlaceholderHelper with the given prefix and suffix. Unresolvable placeholders are ignored by default.
Example
final helper = PropertyPlaceholderHelper('\#{', '}');
Implementation
PropertyPlaceholderHelper(String placeholderPrefix, String placeholderSuffix)
: this.more(placeholderPrefix, placeholderSuffix, null, null, true);