list the contents of a directory with Dart? - Stack Overflow

PHOTO EMBED

Fri Jun 17 2022 08:29:30 GMT+0000 (Coordinated Universal Time)

Saved by @X17 #dart

Future listDir(String folderPath) async {
  var directory = new Directory(folderPath);
  print(directory);

  var exists = await directory.exists();
  if (exists) {
    print("exits");

    directory
      .list(recursive: true, followLinks: false)
      .listen((FileSystemEntity entity) {
        print(entity.path);
      });
  }
}
content_copyCOPY

https://stackoverflow.com/questions/14268967/how-do-i-list-the-contents-of-a-directory-with-dart