buildFromPath static method

TreeNode<FileSystemEntity> buildFromPath(
  1. FileSystem fs,
  2. String path, {
  3. bool expandRoot = true,
})

Recursively reads a file system path and returns a TreeNode<FileSystemEntity> hierarchy.

Implementation

static TreeNode<FileSystemEntity> buildFromPath(
  FileSystem fs,
  String path, {
  bool expandRoot = true,
}) {
  final entity = fs.isDirectorySync(path)
      ? fs.directory(path)
      : fs.file(path);
  final node = _buildNode(fs, entity);
  if (expandRoot) {
    node.isExpanded = true;
  }
  return node;
}