listFileSystemSync method

List<FileSystemEntity> listFileSystemSync(
  1. FileSystem fileSystem, {
  2. String? root,
  3. bool followLinks = true,
})

Synchronously lists all FileSystemEntitys beneath root that match the glob in the provided fileSystem.

This works much like Directory.listSync, but it only lists directories that could contain entities that match the glob. It provides no guarantees about the order of the returned entities, although it does guarantee that only one entity with a given path will be returned.

root defaults to the current working directory.

followLinks works the same as for Directory.list.

Implementation

List<FileSystemEntity> listFileSystemSync(FileSystem fileSystem,
    {String? root, bool followLinks = true}) {
  if (context.style != p.style) {
    throw StateError("Can't list glob \"$this\"; it matches "
        '${context.style} paths, but this platform uses ${p.style} paths.');
  }

  return _listTreeForFileSystem(fileSystem)
      .listSync(root: root, followLinks: followLinks);
}