allDartFiles method
Returns a list of all .dart files found recursively in the given
directory.
Return only includes files that end with the .dart extension
Throw an EmptyDartFileListException if there is no dart file available.
Implementation
List<File> allDartFiles(Directory directory) {
final dartFiles = directory
.listSync(recursive: true)
.whereType<File>()
.where((f) => f.path.endsWith('.dart'));
if (dartFiles.isEmpty) {
throw EmptyDartFileListException();
} else {
return dartFiles.toList();
}
}