renderPlanTemplate function

String renderPlanTemplate(
  1. String template,
  2. Map<String, String> tokens
)

Expand {{TOKEN}} placeholders in template using the values in tokens. Tokens are case-sensitive; missing tokens are left in place so they show up in the rendered plan (and any test that snapshots the output).

Implementation

String renderPlanTemplate(String template, Map<String, String> tokens) {
  var out = template;
  for (final entry in tokens.entries) {
    out = out.replaceAll('{{${entry.key}}}', entry.value);
  }
  return out;
}