generate method

List<String?> generate(
  1. String str,
  2. DartamakerFormatter? formatter,
  3. int iterations
)

Generate some data based on the template, the format and the number of iterations

Implementation

List<String?> generate(
    String str, DartamakerFormatter? formatter, int iterations) {
  if (iterations <= 0) {
    return <String>[str];
  }

  final res = <String?>[];

  /// Locate tags in the template
  final tags = findTags(str);

  /// Iterate
  var count = 1;
  do {
    _cache.clear();
    final tmp = swap(str, tags, formatter!);
    res.add(tmp);
    count++;
  } while (count <= iterations);

  return res;
}