getAllDartFiles function
Implementation
Future<List<FileSystemEntity>> getAllDartFiles() async {
final files = <FileSystemEntity>[];
var dir = Directory(getLibDirectory());
final filesSubscription = dir
.list(recursive: true)
.where((file) => file.path.substring(file.path.length - 5) == '.dart')
.listen(files.add);
await filesSubscription.asFuture();
await filesSubscription.cancel();
return files;
}