listFileSystem method Null safety

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

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

This works much like Directory.list, 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.


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

  return _listTreeForFileSystem(fileSystem)
      .list(root: root, followLinks: followLinks);