modelsUnder method

List<String> modelsUnder(
  1. String folder
)

The model files under folder (project-relative), recursively.

Implementation

List<String> modelsUnder(String folder) {
  final dir = Directory('$root/$folder');
  if (!dir.existsSync()) return const [];
  final out = <String>[];
  for (final entity in dir.listSync(recursive: true)) {
    if (entity is! File) continue;
    final rel = entity.path.replaceAll(r'\', '/').substring(root.length + 1);
    if (isModel(rel)) out.add(rel);
  }
  return out..sort();
}