sprintf function

String sprintf(
  1. String template,
  2. List values
)

Replaces %d and %s in template with values

Implementation

String sprintf(String template, List<dynamic> values) {
  int i = 0;
  return template.replaceAllMapped(
    RegExp(r"%[sd]"),
    (_) => values[i++].toString(),
  );
}