getImages method

Future<List<File>> getImages(
  1. String path
)

Implementation

Future<List<File>> getImages(String path) async {
  var directory = Directory(path);
  var imageFiles = <File>[];

  await for (var entity
      in directory.list(recursive: true, followLinks: false)) {
    if (entity is File) {
      var extension = entity.path.split('.').last;
      if (fileTypes.contains(extension)) {
        imageFiles.add(entity);
      }
    }
  }
  return imageFiles;
}