resolve static method

String resolve(
  1. String input,
  2. Map<String, String> vars
)

Implementation

static String resolve(String input, Map<String, String> vars) {
  String result = input;

  vars.forEach((key, value) {
    result = result.replaceAll('{{$key}}', value);

    final capitalized =
        value.substring(0, 1).toUpperCase() + value.substring(1);

    result = result.replaceAll('{{${key.capitalize()}}}', capitalized);
  });

  return result;
}