parse method

String parse(
  1. List<String> values
)

Implementation

String parse(List<String> values) {
  var _format =
      format.replaceAllMapped('#', (_) => randomOneDigitInt.toString());

  _format = _format.replaceAllMapped('?', (match) => randomLetter);

  final keysWithBraces = _regex
      .allMatches(_format)
      .map((e) => e.group(0))
      .where((element) => element != null)
      .map((e) => e!)
      .toList();

  String parsedString = _format;
  for (var i = 0; i < keysWithBraces.length; i++) {
    parsedString = parsedString.replaceFirst(keysWithBraces[i], values[i]);
  }
  for (var transformer in transformers) {
    parsedString = transformer(parsedString);
  }

  return parsedString;
}