listFiles static method

Future<List<FileSystemEntity>> listFiles(
  1. String directoryPath, {
  2. bool recursive = false,
})

列出指定目录中的所有文件和子目录。

Implementation

static Future<List<FileSystemEntity>> listFiles(String directoryPath,
    {bool recursive = false}) async {
  Directory directory = Directory(directoryPath);
  List<FileSystemEntity> entities =
      await directory.list(recursive: recursive).toList();
  return entities;
}