interpolate method

String interpolate(
  1. String template
)

template with its {attribute} placeholders replaced by the values of attributes; other placeholders and ${...} expressions stay, and the escapes \{, \}, \$, \\ become the literal characters.

const Size(max: 20).interpolate('at most {max}'); // 'at most 20'
const Size(max: 20).interpolate(r'\{max} is {max}'); // '{max} is 20'

Implementation

String interpolate(String template) => revealMessageEscapes(
  interpolateAttributes(hideMessageEscapes(template), attributes),
);