Use the list() method to list a directory’s contents. The method recurses into subdirectories if the recursive argument is true (default is false). It does not follow symlinks if the followLinks argument is false (default is true).
import 'dart:io'; import 'dart:async'; // Import not needed but added here to explicitly assign type for clarity below. main() async { // Get the system temp directory. var systemTempDir = Directory.systemTemp; // List directory contents, recursing into sub-directories, but not following // symbolic links. Stream<FileSystemEntity> entityList = systemTempDir.list(recursive: true, followLinks: false); await for (FileSystemEntity entity in entityList) print(entity.path); }
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did129453