formatTemplate function

String formatTemplate(
  1. String template,
  2. Map<String, String> values
)

填入占位符 {name};没有给出的占位符原样保留。

Implementation

String formatTemplate(String template, Map<String, String> values) => template.replaceAllMapped(_placeholder, (m) => values[m.group(1)!] ?? m.group(0)!);