好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

读取目录下的文件列表

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);
} 

查看更多关于读取目录下的文件列表的详细内容...

  阅读:61次

上一篇: 获取父目录

下一篇:以行的方式读取文件