type method

  1. @override
Future<FileSystemEntityType> type(
  1. String path, {
  2. bool followLinks = true,
})

Finds the type of file system object that a path points to. Returns a Future

io.FileSystemEntityType.LINK will only be returned if followLinks is false, and path points to a link

If the path does not point to a file system object or an error occurs then io.FileSystemEntityType.notFound is returned.

Implementation

@override
Future<FileSystemEntityType> type(String path,
    {bool followLinks = true}) async {
  try {
    final resolved = await client.resolvePath(path);
    if (resolved['type'] == 'folder') return FileSystemEntityType.directory;
    if (resolved['type'] == 'file') return FileSystemEntityType.file;
  } catch (e) {
    // Path not found
  }
  return FileSystemEntityType.notFound;
}