allFilesInDir function

Iterable<File> allFilesInDir(
  1. String dirPath, {
  2. String? fileExtension,
})

Implementation

Iterable<File> allFilesInDir(String dirPath, {String? fileExtension}) {
  final allFiles = Directory(dirPath).listSync(recursive: true).whereType<File>();
  return fileExtension != null ? allFiles.where((file) => p.extension(file.path) == fileExtension) : allFiles;
}