listTemplates method

  1. @override
List<String> listTemplates()
override

Iterates over all templates.

Implementation

@override
List<String> listTemplates() {
  var found = <String>{};

  for (var root in paths) {
    var directory = Directory.fromUri(Uri.directory(root));

    if (directory.existsSync()) {
      var entities = directory.listSync(
        recursive: recursive,
        followLinks: followLinks,
      );

      for (var entity in entities) {
        if (isTemplate(entity.path)) {
          var uri = Uri.file(relative(entity.path, from: root));
          found.add(uri.path);
        }
      }
    }
  }

  return found.toList()..sort();
}