buildStringPattern function
Builds a string using as place holders in the format {{key}}
from parameters
and extraParameters
.
Implementation
String? buildStringPattern(String? pattern, Map? parameters,
[List<Map?>? extraParameters]) {
if (pattern == null) return null;
return replaceStringMarks(pattern, stringPlaceholderPattern, (varName) {
while (varName.startsWith('/')) {
varName = varName.substring(1);
}
while (varName.endsWith('/')) {
varName = varName.substring(0, varName.length - 1);
}
var val = findKeyPathValue(parameters, varName);
if (val == null && extraParameters != null) {
for (var parameters2 in extraParameters) {
if (parameters2 != null && parameters2.isNotEmpty) {
val = findKeyPathValue(parameters2, varName);
if (val != null) break;
}
}
}
return val != null ? val.toString() : '';
});
}