replaceWrappedWithMap method
Replaces the placeholders in the String
with the values from the provided values
map.
The placeholders are Map keys surrounded by openWrapChar
and closeWrapChar
.
Implementation
String replaceWrappedWithMap({required Map<String, dynamic> values, required String openWrapChar, String? closeWrapChar}) {
if (isBlank) return blankIfNull;
string text = this;
values.forEach((key, value) {
String wrappedKey = key.wrap(openWrapChar, closeWrapChar);
text = text.replaceAll(wrappedKey, value?.toString() ?? "");
});
return text;
}