PropertyPlaceholderHelper.more constructor

PropertyPlaceholderHelper.more(
  1. String placeholderPrefix,
  2. String placeholderSuffix,
  3. String? valueSeparator,
  4. Character? escapeCharacter,
  5. bool ignoreUnresolvablePlaceholders,
)

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 full configuration.

  • valueSeparator allows default values (e.g., \#{name:default})
  • escapeCharacter allows placeholders to be escaped (e.g., \\\#{name})
  • ignoreUnresolvablePlaceholders controls if unresolved placeholders throw an error

Example

final helper = PropertyPlaceholderHelper.more('\#{', '}', ':', r'\', false);

Implementation

PropertyPlaceholderHelper.more(String placeholderPrefix, String placeholderSuffix,
			String? valueSeparator, Character? escapeCharacter,
			bool ignoreUnresolvablePlaceholders) {
		parser = PlaceholderParser(placeholderPrefix, placeholderSuffix, valueSeparator, escapeCharacter, ignoreUnresolvablePlaceholders);
	}