applyParams method
Replaces every ${param} with the given parameter
Implementation
String applyParams(
Map<String, ValueFormatter> existingTypes,
String locale,
Map<String, Object> param,
) {
return replaceDartNormalizedInterpolation(replacer: (match) {
final nodeParam = match.substring(2, match.length - 1);
final colonIndex = nodeParam.indexOf(':');
if (colonIndex == -1) {
// parameter without type
final providedParam = param[nodeParam];
if (providedParam == null) {
return match; // do not replace, keep as is
}
return providedParam.toString();
}
final paramName = nodeParam.substring(0, colonIndex).trim();
final paramType = nodeParam.substring(colonIndex + 1).trim();
final providedParam = param[paramName];
if (providedParam == null) {
return match; // do not replace, keep as is
}
return digestL10nOverride(
locale: locale,
existingTypes: existingTypes,
type: paramType,
value: providedParam,
) ??
providedParam.toString();
});
}