listDartSources function

List<String> listDartSources(
  1. String root
)

Every .dart file under root, recursively, in path order.

Implementation

List<String> listDartSources(String root) {
  final dir = Directory(root);
  if (!dir.existsSync()) return const [];
  return dir
      .listSync(recursive: true)
      .whereType<File>()
      .map((f) => f.path)
      .where((path) => p.extension(path) == '.dart')
      .toList()
    ..sort();
}